Installation

https://docs.docker.com/linux/step_one/

$ curl -fsSL "https://get.docker.com/" | sh

https://docs.docker.com/compose/install/

$ curl -L "https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname -s`-`uname -m`" > "/usr/local/bin/docker-compose"
$ chmod +x "/usr/local/bin/docker-compose"

Mirror

/etc/docker/daemon.json

{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

/etc/default/docker

DOCKER_OPTS="--registry-mirror=http://hub-mirror.c.163.com"

Shortcuts

List containers

$ docker ps --all
$ docker ps --all --latest=false

List images

$ docker images

Remove all containers

$ docker rm $(docker ps -a -q)

Remove all volumes

$ docker volume rm $(docker volume ls -q)

Remove all images

$ docker rmi $(docker images -q)

Build image from Dockerfile

$ docker build -t 'chon/example' ./app

Save image to file

$ docker save 'chon/example' > 'chon-example.tar.gz'