一、环境:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
二、卸载旧版本docker
sudo apt-get remove docker docker-engine docker.io containerd runc
如有docker-ce可加入卸载
如要卸载docker引擎:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd
三、设置存储库
1.更新apt包索引并安装包以允许apt通过 HTTPS 使用存储库
sudo apt-get update
sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
2.添加 Docker 的官方 GPG 密钥
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
3.使用以下命令设置存储库
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
四、安装 Docker 引擎
1.更新apt包索引,安装最新版本的 Docker Engine、containerd 和 Docker Compose
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
2.hello-world 通过运行映像来验证 Docker 引擎是否已正确安装
sudo docker run hello-world
标签:get,containerd,sudo,apt,ce,ubuntu,docker,安装 From: https://www.cnblogs.com/qyan/p/16630988.html