Docker手动安装
Docker手动安装
安装环境: ubuntu
官方脚本
1 | curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun |
1 | curl -sSL https://get.daocloud.io/docker | sh |
手动安装
卸载
1
$ sudo apt-get remove docker docker-engine docker.io containerd runc
设置仓库
1
2
3
4
5
6
7
8
9
10# 更新包
$ sudo apt-get update
# 安装依赖(用以通过https获取仓库)
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# 添加官方GPG秘钥
$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 检索是否拥有指纹信息
$ sudo apt-key fingerprint 0EBFCD88
# 设置稳定版仓库
$ sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ $(lsb_release -cs) stable"安装(Docker Engine-Community)
1
2
3
4
5
6
7
8
9
10
11
12
13
14# 更新包
$ sudo apt-get update
# 安装最新版
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
# 安装指定版本
## 列出您的仓库中可用的版本
$ apt-cache madison docker-ce
显示内容:
docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
## 安装指定版本
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
# 测试安装状态
$ sudo docker run hello-world当前用户添加组
1
$ sudo usermod -aG docker your-user
添加完成后当前用户断开ssh连接, 重新登录即可使用groups查看是否添加成功