Docker commit fills up hard drive; cannot be cleaned up

When I run “docker commit …”, it fills up my hard drive with no way to clear it out. When I then try to delete the container I tried to commit, it cannot be done because my hard drive is full.

I’m somewhat shocked that this user journey is even possible. There should be a command to list and remove whatever artifacts are created as part of a “commit”. As in, my computer is seriously impacted by this and there seems to be no way to undo it.

image

Ok, I was able to delete the container after restarting my computer (I just lost all the work I did this weekend), but it didn’t reclaim the hard drive space. To be clear, I had 70 GB of free hard drive space that is now being held hostage by Docker.

I followed these instructions which reduced it by about 25 GB, but that’s a far cry from the 70 GB I had moments before the “commit” command.

you can try docker system prune to clear up the hard drive

Ok, it looks like this can be mitigated by moving the file to a new drive. I followed most of the instructions below by stopping WSL, making a backup of the WSL into an new directory, and re-registering the Docker WSL entry using that backup.

Thanks for the idea. I avoided it because the first message says it will delete all stopped Containers, but I really, really didn’t want to accidentally delete some of my containers. I think I could start the Containers I didn’t want to use and add tags and then a filter in the command to not clean up objects with those tags. But, it was too scary at the time.

Now that I have some free space by moving everything to a drive with much more free space, I might try it tomorrow after work.

1 Like