Show Menu
Cheatography

Docker User Guide Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Docker Daemon

sudo systemctl start docker
Start Docker Daemon
sudo systemctl stop docker
Stop Docker Daemon
sudo systemctl restart docker
Restart Docker Daemon
sudo systemctl status docker
Check if Docker Daemon is running
If you do not have systemctl, use the service command "
sudo service docker [start­|st­op|­sta­tus­|re­start]
"

Docker Common Command Line

docker version
Show docker client and server version
docker info
Show docker server inform­ation
docker images
List of installed docker images
docker stats
Resource Utilic­ation Monitoring
docker ps [-a]

docker container ls
List of containers
Option
-a: all container

Running container

nvidia­-docker run [OPTIONS] IMAGE[­:TAG] [COMMAND] [ARG...]
Run container from a given image
Options
--name
container name
-i
Intera­ctive session
-t
terminal TTY
--rm
remove when exited
-p H:C
Exposes the port C of the container to the port H of the host
-P
expose all port
-v H:C
Mount the host path H at the path C in the container
-w
set working directory in container
-m
memory limit
--cpus­et-cpus
limit cpus to run
--add-host
custom host:ip setting
--priv­ileged
open kernal functions
Enables GPU selection (with NV_GPU option)
NV_GPU=1,3
nvidia­-docker run --rm nvidia­/caffe nvidia-smi
Multi GPU Selection
Select with GPU Topology with NVLINK
nvidia­-docker run  --rm nvidia­/cu­da:­8.0­-cu­dnn­6-d­eve­l-u­bun­tu16.04  nvidia-smi topo  -m

Managing Container

docker logs {CONTA­INE­RNAME}
Get the logs of the container
docker kill {CONTA­INE­RNAME}
Kill the container
docker inspect {CONTA­INE­RNAME}
Inspect the details of a container
docker start {CONTA­INE­RNAME}
start container
docker stop {CONTA­INE­RNAME}
stop container
docker rm [-f] {CONTA­INE­RNAME}
Remove the container
Option:
-f: Force removal of the container
docker rm $(docker ps -a -f status­=exited -q)
Removing all exited containers
docker rm `docker ps - a -q`
Removing all stopped containers

Managing Image

docker search {IMAGE­NAME}
Search image
docker pull {IMAGE­NAME}
Pull an image
docker rmi {IMAGE­NAME}
Remove image
docker rmi $(docker images -a -q)
Remove all imges
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
Stop and Remove all image

NVIDIA Docker Repository

docker login nvcr.io
Login to a Repository
Username: $oauth­token
Password: {API Token}
docker logout nvcr.io
Logout