published: 9th of December 2020
Docker is a fantastic tool. In this post I am documenting common/useful commands for working with the Docker CLI.
Show all local running containers.
docker container ls
Show all local containers.
docker container ls -a
Stop all local running containers.
docker container stop $(docker container ps -a -q)
Delete all local stopped containers.
docker container rm $(docker container ps -a -q)
Show all local images.
docker images ls
Remove dangling image layers.
docker images ls --quiet --filter 'dangling=true'
Delete all local images.
docker rmi $(docker images -a -q)
Pull an image from Docker Hub with the latest tag.
docker pull ruby
Pull a specific version of an image.
docker pull debian:10.7-slim
docker pull ruby:2.7.2-slim-buster
docker pull postgres:13.1
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes