Skip to main content

Manage Docker containers and images.

# To list currently running docker containers:
docker ps

# To list all docker containers (running and stopped):
docker ps -a

# To start a container from an image, with a custom name:
docker run --name <container_name> <image>

# To start or stop an existing container:
docker <start|stop> <container_name>

# To pull an image from a docker registry:
docker pull <image>

# To open a shell inside of an already running container:
docker exec -it <container_name> <sh>

# To remove a stopped container:
docker rm <container_name>

# To fetch and follow the logs of a container:
docker logs -f <container_name>

# ---

# To prune all Docker unused objects:
docker system prune --volumes --force