Random small break-fix or enlightening ideas
I have a few docker hosts used for development, and sometimes I need to clean out all images/containers/network groups and start from scratch. These commands do just that. Obviously don’t run these on any machines w/ persistent data. Use with caution!
Linux Hosts (no Docker GUI)
Relatively safe cleanup – these commands remove dangling images/volumes that are likely no longer used and just taking up space.
#[root]$ docker system prune -f #[root]$ docker rmi $(docker images -f "dangling=true" -q) #[root]$ docker volume rm $(docker volume ls -q -f dangling=true)
#[root]$ docker kill $(docker ps -a -q) #[root]$ docker rm $(docker ps -a -q) #[root]$ docker rmi $(docker images -q) -f
MacOS Hosts (Docker GUI)
I’ve had times where the Docker image completely fills up, and cleaning up images to not free up space. So it’s just easier to delete the Virtualbox image and restart Docker.
Delete the Docker VM disk file:
[user]$ rm -f ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
Restart Docker using the Docker GUI.