更新apt源
- sudo apt-get update
- sudo apt-get install apt-transport-https ca-certificates
- sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
- 如果出现无法获取key错误信息,多试几次即可
根据系统选择添加的仓库
ubuntu version | Repository |
---|---|
Precise 12.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-precise main |
Trusty 14.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-trusty main |
Wily 15.10 | deb https://apt.dockerproject.org/repo ubuntu-wily main |
Xenial 16.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-xenial main |
-
sudo apt-add-repository {Repository}
- 如果出现:sudo: apt-add-repository: command not found
- 执行:sudo apt-get install software-properties-common
sudo apt-get update
-
sudo apt-cache policy docker-engine(查看所有docker版本)
*
- sudo apt-get install -y docker-engine={{version}} 按需拷贝对应version
- sudo apt-get install docker-engine=1.13.1-0~ubuntu-trusty
- sudo apt-get install docker-engine=1.13.1-0~ubuntu-xenial
- 升级docker版本
- 1.12.6 -> 1.13.1
- sudo apt-get update && sudo apt-get upgrade docker-engine:1.13.1-0~ubuntu-xenial
- via:https://docs.docker.com/cs-engine/1.12/upgrade/
- 运行命令后,有很大的几率无法下载,提示速度很慢
- 可以在/etc/apt/source.list 中将先前倒入的repo的地址中的https改成http 速度会在一定程度上变快
- sudo apt-get install -y docker-engine={{version}} 按需拷贝对应version
安装完成 添加用户
sudo usermod -aG docker $USER
exit后重新登录后生效
-
检查docker是否运行
- Ubuntu 16.04:sudo systemctl status docker
- Ubuntu 14.04/16.01 : ps aux|grep docker
-
docker image 默认存放目录
- /var/lib/docker/aufs