CheatSheets
Docker CheatSheet
CheatSheet
To start the docker daemon:
To build a docker image:
To start a container with an interactive shell:
To run a docker container in the background:
To "shell" into a running container (docker-1.3+):
To inspect a running container:
To get the process ID for a container:
To list (and pretty-print) the current mounted volumes for a container:
To copy files/folders between a container and your host:
To list currently running containers:
To list all containers:
To remove all stopped containers:
To remove all stopped containers:
To list all images:
To only see all images id:
To remove all untagged images:
To remove all volumes not used by at least one container:
To save image as tar archive:
To restore image from a saved tar archive:
To remove an image:
To tag an image:
To login into hub.docker.com:
To push a docker image into dockerhub repository:
List all networks daemon knows about:
Create a specific network:
Connect a specific container to a network:
Disconnect a specific container from network:
To see the logs of a background or stopped container:
To publish a port of container on localhost:
To create a docker volume:
To see information of a docker volume:
To use a volume in the container:
To link current folder between host and container for development:
To copy a file from the running container to host machine:
To copy a file from host machine to the running container:
Docker CLI Overview
Manage Docker containers and images efficiently using the following commands. For more detailed documentation on specific subcommands, such as docker run
, refer to the official Docker CLI documentation.
List All Docker Containers
Lists all Docker containers, both running and stopped.
Start a Container from an Image
Starts a new container from the specified image with a custom name.
Start or Stop an Existing Container
Starts or stops the specified container.
Pull an Image from a Docker Registry
Downloads an image from a Docker registry to your local system.
Display the List of Downloaded Images
Shows all images available locally.
Open a Shell Inside a Running Container
Accesses an interactive shell in the specified running container.
Remove a Stopped Container
Deletes the specified stopped container.
Fetch and Follow the Logs of a Container
Displays the logs of the specified container and follows them in real-time.