Docker cheatsheet

Get status of all docker containers

docker ps

Get status of all images in the current folder

docker-compose ps

Get a list of all docker containers

docker container ls

Deleting or clearing out the docker system altogether, this will remove all containers, network, etc that are currently running:

docker system prune

If you’d like to remove the cached containers, networks, etc, add -a

docker system prune -a

Attaching to a container, this is useful if you have a web server you’re running and want to watch the standard output. I use this for rails server and with byebug I can debug (you can use container ID or container name but it’s easier to use container name):

docker attach [container_name]