ubuntu下安装docker
- 卸载原生docker
- 更新软件包
- 安装依赖
- Docker官方GPG密钥
- 添加软件来源仓库
- 安装docker
- 添加用户组
- 运行docker
- 安装工具
- 重启docker
- helloworld
卸载原生docker
$ apt-get remove docker docker-engine docker.io containerd runc
更新软件包
apt-get update
apt-get upgrade
安装依赖
apt-get install ca-certificates curl gnupg lsb-release
Docker官方GPG密钥
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
添加软件来源仓库
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
安装docker
apt-get install docker-ce docker-ce-cli containerd.io
添加用户组
sudo usermod -aG docker $USER
运行docker
systemctl start docker
安装工具
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
重启docker
service docker restart
helloworld
sudo docker run hello-world