Docker commands

List all docker containers (running and stopped)

docker ps --all

Start a container from an image, with a custom name

docker run --name container_name image

Start or stop an existing container

docker start|stop container_name

Pull an image from a Docker registry

docker pull image

Display the list of already downloaded images

docker images

Open a shell inside a running container

docker exec -it container_name sh

Remove a stopped container

docker rm container_name

Fetch and follow the logs of a container

docker logs -f container_name

You should also read:


Imani is a RHEL Engineer at Red Hat. He wants to teach a young class of engineers about Docker by showing them examples…


Ina is a RHEL Manager at Red Hat. Due to an IT labor shortage, Red Hat is having a hard time filling all…


Lebron is a high-level semi-professional basketball player in California. It's a beautiful summer day, and he goes to the local YMCA with his…