Docker CLI
List all docker containers, running and stopped:
Start a container from an image, with a custom name:
docker run --name ubuntu ubuntu:latest
Start an existing container:
Stop an existing container:
Remove a stopped container:
Pull an image from dockerhub:
Display the list of already downloaded images:
Fetch and follow the logs of a container:
Cleanup dangling images, containers, volumes, and networks
Open a shell inside a running container:
docker exec -it ubuntu /bin/bash
docker exec -it ubuntu uname -a
docker exec -it ubuntu pwd
Stop and Remove ALL containers
docker stop $(docker ps -aq); docker rm $(docker ps -aq)
Stop ALL containers
docker stop $(docker ps -a -q)
Remove ALL containers
docker rm -f $(docker ps -a -q)