Docker Cheatsheet

Sun, Jun 4, 2017
Category: cheatsheet Tags: [docker] [devops]

Table of Contents

Container vs Image

Image is immutable, container is a box running starting from an image.

docker ps -as
# list all containers with sizes

docker images
# list all images

docker run [options] <image>
# best to use image id or image:tag
# -p hostPort:containerPort expose port, -P publish all exposed ports. 8888 for jupyter notebook
# -t terminal pseudo-TTY
# -i Keep STDIN open even if not attached
# -v /host/dir:/<container-path>
# --name Assign a name to the container

docker start -ai <container>
# can user container id or name
# -a Attach STDOUT/STDERR and forward signals
# -i Attach container's STDIN

jupyter notebook --ip 0.0.0.0 --no-browser
# run server at ip 0.0.0.0 and access in host at localhost(127.0.0.1) at the allowed port
comments powered by Disqus