DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Understand the Sidecar Pattern by Deploying n8n to AWS Fargate
  • The Startup Time Trick Hiding Inside Your Docker Build
  • Containerizing Spark and Lakehouse Development with Docker
  • How Docker Is Becoming an AI Development Platform

Trending

  • Small Language Models on Apple Silicon for Responsive AI Applications
  • Why Real-Time Data Pipelines Are Becoming the Foundation of Industrial AI
  • RAG, Vector Databases, and MCP: Wiring Them Together for Production
  • Distributing Massive AI Models With Network-Layer Multicast
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Docker: Bulk Remove Images and Containers

Docker: Bulk Remove Images and Containers

By 
Mike Hadlow user avatar
Mike Hadlow
·
Apr. 02, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
14.8K Views

Join the DZone community and get the full member experience.

Join For Free

I’ve just started looking at Docker. It’s a cool new technology that has the potential to make the management and deployment of distributed applications a great deal easier. I’d very much recommend checking it out. I’m especially interested in using it to deploy Mono applications because it promises to remove the hassle of deploying and maintaining the mono runtime on a multitude of Linux servers.

I’ve been playing around creating new images and containers and debugging my Dockerfile, and I’ve wound up with lots of temporary containers and images. It’s really tedious repeatedly running ‘docker rm’ and ‘docker rmi’, so I’ve knocked up a couple of bash commands to bulk delete images and containers.

Delete all containers:

sudo docker ps -a -q | xargs -n 1 -I {} sudo docker rm {}

Delete all un-tagged (or intermediate) images:

sudo docker rmi $( sudo docker images | grep '<none>' | tr -s ' ' | cut -d ' ' -f 3)

Docker (software)

Published at DZone with permission of Mike Hadlow. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Understand the Sidecar Pattern by Deploying n8n to AWS Fargate
  • The Startup Time Trick Hiding Inside Your Docker Build
  • Containerizing Spark and Lakehouse Development with Docker
  • How Docker Is Becoming an AI Development Platform

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook