This is a draft cheat sheet. It is a work in progress and is not finished yet.
Docker image manipulations
Run detached container - Debian OS |
docker -dit debian |
Stop container |
docker stop [CONTAINER CID] |
Show docker images |
docker images |
Show docker image info in YAML |
docker inspect [CONTAINER CID] |
Get docker image |
docker pull [IMAGE NAME] |
Get how image was constructed |
docker history [IMAGE NAME] |
Show full image hash |
docker images --no-trunc |
Create image tag |
docker tag SOURCE[:TAG] TARGET[:TAG] |
pause a container |
docker pause [CONTAINER CID] |
unpause a paused container |
docker unpause [CONTAINER CID] |
send a kill signal to a running container |
docker kill [CONTAINER CID] |
block until a running container stops |
docker wait [CONTAINER CID] |
connect to a running container |
docker attach [CONTAINER CID] |
rename an existing container |
docker rename container-name new-container-name |
rename an existing container |
docker run --rm image-name |
|
|
Dockerfile Manipulations
Simple Dockerfile example |
FROM debian:stable LABEL maintainer="ENTER_YOUR_NAME_HERE" RUN apt update && apt install -y nano && apt clean CMD [ "/bin/bash" ]
|
Simple Dockerfile example
Docker Information Commands
Docker Information Commands |
docker info |
To list only running containers |
docker ps |
To list all containers |
docker ps -a |
print the object information about a container |
docker logs container-id |
print all running processes in a container |
docker top container-id |
print the live resource usage of any container |
docker stats cntainer-id |
print the changes on files and directories in a filesystem |
docker diff container-id |
|
|
Docker Volume commands
create a new Docker volume |
docker volume create volume-name |
list all Docker volumes |
docker volume list |
print more information about a Docker volume |
docker volume inspect volume-name |
remove a Docker volume from your system |
docker volume rm volume-name |
Docker networking
list all the networks |
list all the networks |
print information about one or more networks |
docker network inspect network-name |
connect a container to a network |
docker network connect network-name container-name |
disconnect a container from a network |
docker network disconnect network-name container-name |
remove one or more networks |
docker network rm network-name |
|
|
|