Linux安装docker过程中出现版本依赖问题该如何解决

您所在的位置:网站首页 linux安装数据库依赖检测失败怎么办 Linux安装docker过程中出现版本依赖问题该如何解决

Linux安装docker过程中出现版本依赖问题该如何解决

2024-07-04 09:59| 来源: 网络整理| 查看: 265

安装docker的官方步骤,参考docker的官方网站:https://docs.docker.com/engine/install/centos/。

为了保证docker的安装过程顺利,首先要注意部署docker的环境,小编的环境Red Hat Enterprise Linux Server release 7.5,内核:3.10.0-862.el7.x86_64,安装docker对系统环境要求:centos7.5 64位 内核版本高于3.10,centos6.5 64位 内核版本高于2.6.32,因为内核包含了运行Docker的一些特定修改。

这里简单描述安装步骤,详细步骤请参考官方网站:

卸载自带的包: 1 yum remove docker \ 2 docker-client \ 3 docker-client-latest \ 4 docker-common \ 5 docker-latest \ 6 docker-latest-logrotate \ 7 docker-logrotate \ 8 docker-engine 安装依赖包: 1 yum install -y yum-utils  设置镜像: 1 yum-config-manager \ 2 --add-repo \ 3 https://download.docker.com/linux/centos/docker-ce.repo 执行安装命令,安装docker: 1 yum install docker-ce docker-ce-cli containerd.io 启动docker: 1 systemctl start docker 输入docker version来测试docker是否成功安装:

 如果看到上述的client和server,说明两者均起成功,如果docker只启动了client,通过输入service docker start或者systemctl restart docker来开启server,之后再次输入docker version来验证;

 

完成之后可以用docker测试helloworld,步骤如下:

输入docker pull hello-world来拉取hello-world镜像

 输入docker run hello-world运行,出现下图所示内容,说明hello-world运行成功:

 

 

小编在安装的过程中出现版本依赖问题,研究了好久才终于彻底解决。

下面是执行安装命令的时候出现的问题:

1 [root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io 2 Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager 3 This system is not registered with an entitlement server. You can use subscription-manager to register. 4 Resolving Dependencies 5 --> Running transaction check 6 ---> Package containerd.io.x86_64 0:1.4.6-3.1.el7 will be installed 7 --> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.6-3.1.el7.x86_64 8 ---> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed 9 --> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.7-3.el7.x86_64 10 --> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.7-3.el7.x86_64 11 ---> Package docker-ce-cli.x86_64 1:20.10.7-3.el7 will be installed 12 --> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.7-3.el7.x86_64 13 --> Running transaction check 14 ---> Package containerd.io.x86_64 0:1.4.6-3.1.el7 will be installed 15 --> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.6-3.1.el7.x86_64 16 ---> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed 17 --> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.7-3.el7.x86_64 18 ---> Package docker-ce-rootless-extras.x86_64 0:20.10.7-3.el7 will be installed 19 --> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64 20 --> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64 21 ---> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed 22 --> Finished Dependency Resolution 23 Error: Package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64 (docker-ce-stable) 24 Requires: fuse-overlayfs >= 0.7 25 Error: Package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64 (docker-ce-stable) 26 Requires: slirp4netns >= 0.4 27 Error: Package: 3:docker-ce-20.10.7-3.el7.x86_64 (docker-ce-stable) 28 Requires: container-selinux >= 2:2.74 29 Installed: 2:container-selinux-2.68-1.el7.noarch (@extras) 30 container-selinux = 2:2.68-1.el7 31 Available: 2:container-selinux-2.42-1.gitad8f0f7.el7.noarch (extras) 32 container-selinux = 2:2.42-1.gitad8f0f7.el7 33 Available: 2:container-selinux-2.55-1.el7.noarch (extras) 34 container-selinux = 2:2.55-1.el7 35 Available: 2:container-selinux-2.66-1.el7.noarch (extras) 36 container-selinux = 2:2.66-1.el7 37 Error: Package: containerd.io-1.4.6-3.1.el7.x86_64 (docker-ce-stable) 38 Requires: container-selinux >= 2:2.74 39 Installed: 2:container-selinux-2.68-1.el7.noarch (@extras) 40 container-selinux = 2:2.68-1.el7 41 Available: 2:container-selinux-2.42-1.gitad8f0f7.el7.noarch (extras) 42 container-selinux = 2:2.42-1.gitad8f0f7.el7 43 Available: 2:container-selinux-2.55-1.el7.noarch (extras) 44 container-selinux = 2:2.55-1.el7 45 Available: 2:container-selinux-2.66-1.el7.noarch (extras) 46 container-selinux = 2:2.66-1.el7 47 You could try using --skip-broken to work around the problem 48 You could try running: rpm -Va --nofiles --nodigest

即便是重新安装 yum reinstall container-selinux ,还是会出现上面的那种提示,其实真正的原因是所配置的yum仓库的软件包不是最新的,所以解决办法就是更换/etc/yum.repos.d/CentOS7-Base-163.repo。小编这里提供下面两种:

1、中科大(参考地址:http://mirrors.ustc.edu.cn/help/centos.html#) 1 # CentOS-Base.repo 2 # 3 # The mirror system uses the connecting IP address of the client and the 4 # update status of each mirror to pick mirrors that are updated to and 5 # geographically close to the client. You should use this for CentOS updates 6 # unless you are manually picking other mirrors. 7 # 8 # If the mirrorlist= does not work for you, as a fall back you can try the 9 # remarked out baseurl= line instead. 10 # 11 # 12 [base] 13 name=CentOS-$releasever - Base 14 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 15 baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/ 16 gpgcheck=1 17 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 18 #released updates 19 [updates] 20 name=CentOS-$releasever - Updates 21 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 22 baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/ 23 gpgcheck=1 24 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 25 #additional packages that may be useful 26 [extras] 27 name=CentOS-$releasever - Extras 28 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras 29 baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/ 30 gpgcheck=1 31 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 32 #additional packages that extend functionality of existing packages 33 [centosplus] 34 name=CentOS-$releasever - Plus 35 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus 36 baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/ 37 gpgcheck=1 38 enabled=0 39 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 2、清华源 1 # CentOS-Base.repo 2 # 3 # The mirror system uses the connecting IP address of the client and the 4 # update status of each mirror to pick mirrors that are updated to and 5 # geographically close to the client. You should use this for CentOS updates 6 # unless you are manually picking other mirrors. 7 # 8 # If the mirrorlist= does not work for you, as a fall back you can try the 9 # remarked out baseurl= line instead. 10 # 11 # 12 [base] 13 name=CentOS-$releasever - Base 14 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/ 15 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 16 gpgcheck=1 17 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 18 #released updates 19 [updates] 20 name=CentOS-$releasever - Updates 21 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/ 22 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 23 gpgcheck=1 24 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 25 #additional packages that may be useful 26 [extras] 27 name=CentOS-$releasever - Extras 28 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/ 29 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras 30 gpgcheck=1 31 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 32 #additional packages that extend functionality of existing packages 33 [centosplus] 34 name=CentOS-$releasever - Plus 35 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/ 36 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus 37 gpgcheck=1 38 enabled=0 39 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 修改完成后更新yum源: 1 yum clean all 2 rm -rf /var/cache/yum/ 3 yum makecache

这时候,再次执行安装docker的命令,终于安装成功了!



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3