Cheatography
https://cheatography.com
These are the docker commands I use daily
Creating and Starting
run |
Create and run a container from an image |
run --rm |
Automatically remove the container when it exits |
run -d |
Run container in background and print container ID |
start |
Start one or more stopped containers |
CTRL+P, CTRL+Q |
Detach from container without killing it |
compose.yaml
version (optional) |
services (optional) |
volumes |
networks |
compose services
image |
ports |
environment |
networks |
volumes |
|
|
Monitoring
images |
List local images |
ps |
To list currently running containers |
history |
Show the history of an image |
inspect |
Return low-level information on Docker objects |
attach |
Attach local standard input, output, and error streams to a running container |
stop |
Stop one or more running containers |
logs |
Fetch the logs of a container |
exec |
Execute a command in a running container |
Compose
up |
Create and start containers |
up -d |
Detached mode: Run containers in the background |
stop |
Stop services |
start |
Start services |
logs |
View output from containers |
down |
Stop and remove containers, networks |
down -v |
Remove containers, netwRemove named volumes declared in the "volumes" section of the Compose file and anonymous volumes attached to containers.orks, volumes |
|
|
Networking
run -p |
Publish a container's port(s) to the host |
run --network |
Connect a container to a network |
network |
Manage networks |
network create -d |
Driver to manage the Network: none, bridge, host, overlay, macvlan |
Dockerfile
FROM |
Create a new build stage from a base image |
RUN |
Execute build commands |
Build image
build |
Build an image from a Dockerfile |
build -t |
Name and optionally a tag in the name:tag format |
Volumes
run -v |
Bind mount a volume |
volume create |
Create a volume |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by nirintsoa