本文共 1087 字,大约阅读时间需要 3 分钟。
一 .安装Docker
参考链接:
0. 移除旧版本(新用户不需要)
sudo apt-get remove docker docker-engine docker.io containerd runc
1. 更新源
sudo apt-get update
2.添加源
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
3.添加key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.验证key
sudo apt-key fingerprint 0EBFCD88
会输出:
pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88uid [ unknown] Docker Release (CE deb)sub rsa4096 2017-02-22 [S]
5.设置源(amd64+x86)
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
6.安装
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io
7.验证
sudo docker run hello-world
输出:
Hello from Docker!
This message shows that your installation appears to be working correctly.二 .增加sudo权限
参考链接:
1.创建docker组:
sudo groupadd docker
2.将当前用户加入docker组:
sudo gpasswd -a ${USER} docker
3.重启服务:
sudo service docker restart
4.刷新docker成员:
newgrp - docker
转载地址:http://hnisn.baihongyu.com/