您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
08_尚硅谷_Docker_CentOS7安装Docker简介(补充知识请看34集)
发布时间:2022-11-04 23:33:26编辑:雪饮阅读()
step1 设置存储库
实际上你在docker官网上发现到处都是推荐docker桌面的安装,然后你发现对centos好像不怎么待见,实际上稍微细心点,你可以在docker引擎哪里找到在centos上安装的文档,主要就是安装docer-ce,而我们实际上也正好就是需要docker引擎才是对的,docer-ce就是docker社区版。community edition的简写。
yum install -y yum-utils(可能会执行失败,如file:///tmp/snowDrink/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /tmp/snowDrink/repodata/repomd.xml"
Trying other mirror.这种影响不大,它不是还尝试其它镜像咯)
添加repo源(这就很精简,比之前那种手动配置repo爽多了)
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo(可能会执行失败,如:
[root@DESKTOP-7ONFN16 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 12] Timeout on https://download.docker.com/linux/centos/docker-ce.repo: (28, 'Connection timed out after 30005 milliseconds')
那么你可以手动下载https://download.docker.com/linux/centos/docker-ce.repo,
然后将下载的docker-ce.repo给--add-repo,如:
[root@DESKTOP-7ONFN16 ~]# yum-config-manager --add-repo docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: docker-ce.repo
grabbing file docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
)
安装docker引擎
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
这步仍旧会出错,如:
[root@DESKTOP-7ONFN16 ~]# yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Loaded plugins: fastestmirror
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30079 milliseconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30009 milliseconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30041 milliseconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30011 milliseconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [E rrno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in p rogress"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [E rrno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/rep odata/repomd.xml: (28, 'Connection timed out after 30004 milliseconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
Trying other mirror.
One of the configured repositories failed (Docker CE Stable - x86_64),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=docker-ce-stable ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable docker-ce-stable
or
subscription-manager repos --disable=docker-ce-stable
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true
failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30079 milliseconds')
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30009 milliseconds')
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30041 milliseconds')
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30011 milliseconds')
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: (28, 'Connection timed out after 30004 milliseconds')
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to download.docker.com:443; Operation now in progress"
那么哥这边建议是用极光翻墙软件Aurora在宿主机翻墙下再试试。
docker版本
[root@DESKTOP-7ONFN16 ~]# docker --version
Docker version 20.10.21, build baeda1f
docker状态及启动docker服务
[root@DESKTOP-7ONFN16 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
Nov 04 11:26:48 DESKTOP-7ONFN16 systemd[1]: [/usr/lib/systemd/system/docker.service:37] Unknown lvalue 'TasksMax' in section 'Service'
Nov 04 11:26:48 DESKTOP-7ONFN16 systemd[1]: [/usr/lib/systemd/system/docker.service:37] Unknown lvalue 'TasksMax' in section 'Service'
[root@DESKTOP-7ONFN16 ~]# systemctl start docker
[root@DESKTOP-7ONFN16 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2022-11-04 11:30:45 EDT; 2s ago
Docs: https://docs.docker.com
Main PID: 17427 (dockerd)
Memory: 26.4M
CGroup: /system.slice/docker.service
└─17427 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.316574996-04:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.325850889-04:00" level=info msg="Loading containers: start."
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.726436547-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemo...d IP address"
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.832708531-04:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.891274469-04:00" level=info msg="Loading containers: done."
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.898962095-04:00" level=warning msg="Not using native diff for overlay2, this may cause degraded performance f...iver=overlay2
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.899073052-04:00" level=info msg="Docker daemon" commit=3056208 graphdriver(s)=overlay2 version=20.10.21
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.899461829-04:00" level=info msg="Daemon has completed initialization"
Nov 04 11:30:45 DESKTOP-7ONFN16 systemd[1]: Started Docker Application Container Engine.
Nov 04 11:30:45 DESKTOP-7ONFN16 dockerd[17427]: time="2022-11-04T11:30:45.912522163-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
关键字词:Docker,CentOS7,安装,补充,知识,请,看,34,集,简介