Andre Schütz - Learn. Think. Reflect - Tech developer
Docker remove old images and containers

Docker remove old images and containers

By the time, old images and containers are still on the system and use a lot of disk space.

Show old containers and images

See the docker images with their ID:

docker images -a

See the stopped docker containers with their ID:

docker ps -a | grep Exit
or
docker ps -a -f status=exited

Remove single containers and images

Remove a container:

docker rm CONTAINERID

Remove an image:

docker rmi CONTAINERID

Force to remove an image if it is still referenced:

docker rmi -f CONTAINERID

A list of additional command options and other useful commands can be found here: https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes