docker升级至指定版本
背景:本来我的本机docker是20的,现在需要19.03.8,所以打算先删除docker,然后再重新安装。1. 删除docker关闭dockersudo systemctl stop docker# 卸载旧版本:sudo apt-get purge docker-ce注:上述代码不会删除镜像和容器。2. 安装指定版本的docker本次安装的是19.03.8# 更新软件源sudo apt-get
·
背景:本来我的本机docker是20的,现在需要19.03.8,所以打算先删除docker,然后再重新安装。
1. 删除docker
关闭docker
sudo systemctl stop docker
# 卸载旧版本:
sudo apt-get purge docker-ce
注:上述代码不会删除镜像和容器。
2. 安装指定版本的docker
本次安装的是19.03.8
# 更新软件源
sudo apt-get update
# 安装所需依赖
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# 安装 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"
# 再次更新软件源
sudo apt-get -y update
# 查看docker版本
sudo apt-cache madison docker-ce
# 安装特定版本的docker
sudo apt-get install docker-ce=5:19.03.8~3-0~ubuntu-xenial docker-ce-cli=5:19.03.8~3-0~ubuntu-xenial
3. 报错以及解决办法
出现下列报错:
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2022-05-25 13:38:10 CST; 20ms ago
Docs: https://docs.docker.com
Process: 22903 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 22903 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...
Processing triggers for systemd (237-3ubuntu10.53) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
解决办法:
cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get install docker-ce=5:19.03.8~3-0~ubuntu-xenial docker-ce-cli=5:19.03.8~3-0~ubuntu-xenial
上述代码参考:Docker问题——安装过程中问题Errors were encountered while processing: docker-ce_辰阳天宇的博客-CSDN博客
更多推荐
已为社区贡献1条内容
所有评论(0)