Docker cheat Sheet

Lifecycle 
Commandline
docker 
--rm                                    remove container automatically after it exits
-it                                       connect the container to terminal
--name web                        name the container
-p 5000:80                         expose port 5000 externally and map to port 80
-v $hostdir:$dockerdir       create a host mapped volume inside the container
alpine:3.4                           the image from which the container is instantiated
/bin/sh                                the command to run inside the container

If you want to poke around in an image, docker run -t -i <myimage> <myshell> to open a tty.

Info 
  •  docker ps          shows running containers.
  •  docker inspect  looks at all the info on a container (including IP address).
  •  docker logs       gets logs from container.
  •  docker events   gets events from container.
  •  docker port       shows public facing port of container.
  •  docker top        shows running processes in container.
  •  docker diff        shows changed files in the container's FS.
  •  docker ps -a      shows running and stopped containers.

 Images
  •  docker history     shows history of image.
  •  docker tag           tags an image to a name (local or registry).



CheatSheet: on ii.icmp.co

Comments