Docker笔记

安装 Docker

1
2
3
4
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
# 或者使用阿里云的镜像安装
sh get-docker.sh --mirror Aliyun

清除 none 的 image

1
2
3
docker image prune
# 如果版本低于 v1.25
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

安装 docker-compose

1
2
3
4
5
6
7
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

docker-compose --version

docker-compose build 不留下 none 的 image

1
docker-compose build --force-rm