Cookie Consent by Free Privacy Policy Generator Cleaning up Docker space | Igor Moiseev

Igor Moiseev Applied mathematician, Web Developer

Cleaning up Docker spaceedit

Regularly cleaning your dangling containers and images.

Step 1: cleaning containers, don’t worry it destroys only stopped containers

docker ps -aq| xargs docker rm

Step 2: removing dangling images

docker rmi $(docker images -q --filter "dangling=true")

Docker itself offers a number of tools to prune and clean up space

  1. Inspecting docker filesystem: docker system df
  2. Pruning stopped containers: docker container prune
  3. Removing all local volumes: docker volume prune
  4. docker system prune will remove
    • all stopped containers
    • all networks not used by at least one container
    • all dangling images
    • all dangling build cache is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means to earn fees when linking to and affiliated sites.