macosdockercontainersdockerfilediskspace

Docker filling up storage on macOS


(Post created on Oct 05 '16)

I noticed that every time I run an image and delete it, my system doesn't return to the original amount of available space.

The lifecycle I'm applying to my containers is:

> docker build ...
> docker run CONTAINER_TAG
> docker stop CONTAINER_TAG
> rm docker CONTAINER_ID
> rmi docker image_id

[ running on a default mac terminal ]

The containers in fact were created from custom images, running from node and a standard redis. My OS is OSX 10.11.6.

At the end of the day I see I keep losing Mbs. How can I face this problem?

EDITED POST

2020 and the problem persists, leaving this update for the community:

Today running:

The easiest way to workaround the problem is to prune the system with the Docker utilties.

docker system prune -a --volumes

Solution

  • WARNING:

    By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the --volumes flag when running the command to prune volumes as well:

    Docker now has a single command to do that:

    docker system prune -a --volumes
    

    See the Docker system prune docs