Docker Cheatsheet
Mar 22, 2016
1 minute read

Docker Cheatsheet

# list all images
docker images

# remove an image
docker rmi <imageid>

# list all running containers
docker ps

# list all containers
docker ps -a

# remove all exited containers
docker rm $(docker ps -q -f status=exited)

# start a container with an interactive session and remove it when stopped
docker run -it --rm --name=mosquitto slucas/alpine-mosquitto /bin/sh

# start a container with a name
docker run -d -p 1883:1883 --name=mosquitto slucas/alpine-mosquitto

# start a container depending on another
docker run -d --link mosquitto:mosquitto --name=mqttwarn slucas/alpine-mqttwarn

# build an image from a local directory
docker build -t ouruser/ourproject:v2 .

# Change entrypoint
docker run -it --rm --device /dev/i2c-1 -v /root/src/fireReading:/data --name python3-cron --entrypoint=/bin/sh seblucas/alpine-python3-cron:1.0

Gestion des liens entre docker :

Reference Dockerfile :

Gestion des logs dans Docker :

Best practice Docker / Alpine

Gestion de l’arrêt des services

Gestion de l’arret / demarrage avec systemd

comments powered by Disqus