Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • macOS 10.13.6
  • Docker Engine 18.9.2
  • Docker Desktop Cli 2.0.0.3

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

docker system prune -a --volumes 
like image 453
Franco Rabaglia Avatar asked Oct 05 '16 16:10

Franco Rabaglia


People also ask

Why is Docker using so much disk space?

Docker takes a conservative approach to cleaning up unused objects (often referred to as “garbage collection”), such as images, containers, volumes, and networks: these objects are generally not removed unless you explicitly ask Docker to do so. This can cause Docker to use extra disk space.

How much space does Docker take on Mac?

Show activity on this post. I have Docker installed on my Mac OS Catalina and recently found very big file Docker. raw. It is 64 Gb.

Where does Docker store data on MacOS?

Windows: C:\ProgramData\DockerDesktop. MacOS: ~/Library/Containers/com. docker.


1 Answers

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

like image 71
zhongjiajie Avatar answered Oct 05 '22 23:10

zhongjiajie