系统需求
- Ubuntu Jammy 22.04 (LTS)
- Ubuntu Impish 21.10
- Ubuntu Focal 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
卸载 Docker 旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
使用 repository 安装 Docker Engine
配置 repository
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
添加 Docker GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
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 Engine
此命令将会安装最新的 Docker Engine, containerd 和 Docker Compose
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
或者安装自选版本 Docker Engine
列出可用的安装版本
apt-cache madison docker-ce
安装自选版本的 Docker Engine, containerd 和 Docker Compose
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin
安装完成后启动 Docker Engine
sudo systemctl start docker
设置 Docker Engine 自启动
sudo systemctl enable docker
卸载 Docker Engine
卸载 Docker Engine, containerd 和 Docker Compose
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin
删除 Docker Engine 所有的残留(images, containers 和 volumes)
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
参考文章:Install Docker Engine on Ubuntu | Docker Documentation
发表评论须遵守中华人民共和国相关法律法规。违规评论将会被删除。
Comments must subject to the relevant laws and regulations of the People’s Republic of China. Offending comments will be deleted.