We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Docker Commands
Cheat Sheet
= mo Hae pm
Orchestra’
To create and run a container:
docker run ~-name container_name docker_inage
Other usetul flags to attach to the dockae run’ command are:
‘a Detach container on start
am Remove container once it stops
=p —Publishhost and host porto the container port
“e _ — Define and share storage volume across containers
=-read-only ~ Sets container to be read only
Clean Up
To clean—or prune—unused (dangling) mages:
decker image prune
To remaveallimages vihich are nt in use by containers ad -:
docker image prune -a
To prune your entire system:
decker system prune
To leavea nar:
decker swarm Leave
To remove a swarm: (Deletes a volume data and database ino also)
decker stack im stack name
To klall unning containers
dockes kill $(aocker pe -a)
Run
To-reate andrun acontainer:
cocker run ~-nane convainer_name docker_snage
Other useful flags:
“a. = Detach container on start
Tan — Remove container ance itstops
p — Publish host IP and host port tothe container port
¥ Define and share volume across containers
~-read-only — Sets container to be readonly
Build
To pullan image from the Registry define ‘imagename!:
decker pull image_nane:tag
To built an image fiom your Dockerfle:
Gocker build -t image name: tag
ityou don’t want your container to autostart use:
Aocker create--nane container_nane image_nane:tag
‘Start and stop container commands:
Gocker start container_nane
Gocker stop containe:
Services
To.lewaistf athe services running in aswarm
decker service Is
To ceellrunning services:
cocker stack services stack nane
To see all service logs:
docker service loge stack nane_service_nane
To scale services quickly across qualified nodes:
Gocker service scale stack name service pane=replicas