Docker在Centos 7上的部署

                                          Docker在Centos 7上的部署linux

 方法1---開啓centos 7上自帶的 extras YUM源,而後 yum install docker來安裝docker

 安裝前必須保證 Linux Kernel 要 3.10+, 用 uname -r 查這個參數centos

  [root@Franklin13 yum.repos.d]# cat CentOS-Base.repo |grep -a2 extrasui

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
enabled=1
gpgcheck=1阿里雲

 但 extras源裏的 docker的版本很低,故採用以下方法:url

方法2 --- 經過下載清華大學上的開源 docker-ce YUM源來安裝spa

 

 

 

 https://download.docker.com ---> 替換成  https://mirrors.tuna.tsinghua.edu.cn/docker-ce3d

 而後出現以下報錯, 經查是清華大學的 URL地址寫錯了,docker-ce後少打了 /。以後修復成功xml

 

 

yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=trueblog

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://mirrors.tuna.tsinghua.edu.cn/docker-celinux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
[root@Franklin13 ~]#

 

 

 

 ---整理相關報錯詳情

--> Finished Dependency Resolution
Error: Package: 2:container-selinux-2.107-3.el7.noarch (extras)
Requires: selinux-policy >= 3.13.1-216.el7
Installed: selinux-policy-3.13.1-166.el7.noarch (@anaconda)
selinux-policy = 3.13.1-166.el7
Error: Package: 2:container-selinux-2.107-3.el7.noarch (extras)
Requires: selinux-policy-targeted >= 3.13.1-216.el7
Installed: selinux-policy-targeted-3.13.1-166.el7.noarch (@anaconda)
selinux-policy-targeted = 3.13.1-166.el7
Error: Package: 2:container-selinux-2.107-3.el7.noarch (extras)
Requires: selinux-policy-base >= 3.13.1-216.el7
Installed: selinux-policy-targeted-3.13.1-166.el7.noarch (@anaconda)
selinux-policy-base = 3.13.1-166.el7
Available: selinux-policy-minimum-3.13.1-166.el7.noarch (c7-media)
selinux-policy-base = 3.13.1-166.el7
Available: selinux-policy-mls-3.13.1-166.el7.noarch (c7-media)
selinux-policy-base = 3.13.1-166.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@Franklin13 ~]#
[root@Franklin13 ~]# yum update selinux-policy
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* extras: ftp.sjtu.edu.cn
No packages marked for update
[root@Franklin13 ~]#

----------------------故不得不求救於馬雲的阿里雲鏡像, 看以下 --------------------------

 https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

 

 

 

[root@Franklin13 yum.repos.d]# yum install docker-ce (發現只有阿里雲的 docker-ce源能夠自動解決軟件的依賴包問題 )

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

 

 

 

 

[root@Franklin13 yum.repos.d]# systemctl start docker.service
[root@Franklin13 yum.repos.d]# docker version

 

 

 

[root@Franklin13 yum.repos.d]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@Franklin13 yum.repos.d]#
[root@Franklin13 yum.repos.d]# docker info
Client:
Debug Mode: false

Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 19.03.4 Storage Driver: overlay2

相關文章
相關標籤/搜索