docker Cheat
Sheet
<> Z REBEL!
Glossary
Layer - 2 set of read-oniyfles Download anim
te provision the system
Image -aread onl layer that
‘the base of our container
Might have a parent image
Create and start container, run
docker run ~t --nane container name
mage pane comand
Container-a runnable instance
ofthe image
Registry / Hub - central place
winere images lve destroy contain
decker run
Docker machine-2 VM torun
Docker containers (Linux does ample flesyse
this natively) docks run ~i
[path/tolagent. jar: Jagent. jar
sava_oprs="-javangent: /agent ja:”
Docker compose - a utltyo run
multiple containers as a systern ‘roneat:8.0.28.
Container: my-container
Parent image: java:8re
Parent image: buildpack-depsjessie-curl
Useful one-liners
ase
‘docker pull. image _nane
Start and stop the container
docker [start] stop] containes_nane
‘ma -ti inage_nase command
ocker start mpcontainer
|
mmmand
id port mappings
CCreate and start container, run command,
Processes
-
Docker cleanup commands
Kill al running containers
docker MLL #(docker pa a)
Delete dangling images
docker mai G(dockar smages
dangling=teue)
Remove al sto
decker mm $(Gocker pe -a -9)
Docker machine commands
Use docker machine to.run the containers
Start a machine
figure’
fevai °§ (docker-machine
sav machine name)”
docker logs my-con
|
Logs
ll
Docker compose syntax
docker-compose.yn fie example
ccontainer_name: “web
image: java: 4 image nana
4 comand to ron
command: java ~jar /app/app.3ar
porte: # map ports to the host
volumes: # map flesyeten to the Rost
> sJmyapp. 302: /app/app 3a
smonge: # container mane
mage: mongo # isage nae
Create and start containers
Interacting with a container
Run a command in the container
Follow the container logs
decker logs ft container pane
Save a running container as an image
decker comit -m “comit message” -a “author”
‘containar_nane usarnane/iaage vane: tag