Docker Quick Reference

Published on:

Hello World

docker run hello-world

Common Commands

docker info                   # about docker and host
docker run -it ubuntu bash    # run bash shell
docker start aa3              # restart a stopped container
docker attach aa3             # get back into your bash shell

# run in background mode
docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
docker logs --tail 20 -f aa3  # tail -f the logs

# log to syslog
docker run -d \
  --log-driver="syslog" \
  ubuntu \
  /bin/sh -c "while true; do echo hello world; sleep 1; done"

sudo tail -f /var/log/syslog  # to see your logs

docker top d0a                # like ps aux
docker stats die93 29dk3      # like top

docker stop $(docker ps -q)   # stop all
docker rm $(docker ps -a -q)  # remove all

Build and install docker from source

Followed this more or less. Some names were outdated.
http://tristan.lt/blog/docker-4-build-docker-from-sources/

Errata

v1.8.0-rc1

https://github.com/docker/docker/blob/6a274e48dc645f0ea02ae8bf59ce08ff22cfd663/daemon/logger/syslog/syslog.go#L62

syslog-address
syslog-facility
syslog-tag