Docker
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"
Proxy
/etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:1080"
Environment="HTTPS_PROXY=socks5://127.0.0.1:1080"
Mirror
/etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"],
"max-concurrent-downloads": 1
}
/etc/default/docker
DOCKER_OPTS="--registry-mirror=http://hub-mirror.c.163.com --max-concurrent-downloads=1"
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)
Prune
$ docker system df
$ docker system prune --force
$ docker container prune --force
$ docker volume prune --force
$ docker image prune --force
Build image from Dockerfile
$ docker build -t 'my/example' ./app
Save image to file
$ docker save 'my/example' > 'my-example.tar.gz'