Docker 验证 Centos7.2 离线安装 Docker 环境
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker 验证 Centos7.2 离线安装 Docker 环境相关的知识,希望对你有一定的参考价值。
序
题记:搞定了就是故事,搞不定就是事故。
条件有限,开局只有一台开发机,要跑5套子系统组成的项目群。还要有一些辅助和验证的系统要跑在这上面。从配置来看,要想顺畅开心地完成项目群基础环境支撑,考虑引入资源消耗 1/200 的神器 Docker:更难得是丝毫不用担心环境污染、版本冲突、以及突然开发服务器搞崩溃了;
吐槽避免采坑
实际上可能要跑的系统和辅助系统远超预计
申请的是 4C/8G 的 PC server,后来查命令是 1C/2G,10G 空间,果断申请扩容了
边干边写:整了四周;期间无数次崩溃,还要应对乙方内部的质疑,不知道自己是如何坚持下来的
第一周折腾无实质交付
- MacBook上docker环境起了CentOS7.2容器,在容器中模拟离线安装Docker环境(盗梦空间)
- 安装很成功,按官方教程启动服务时,崩溃到怀疑人生:
- 命令” systemctl start docker” 报错:”docker Failed to get D-Bus connection”
- CentOS 从7开始,安全考虑,容器内默认不加载 D-Bus:直接影响就是systemctl不能起服务;
- github支招:加容器特权参数 –privileged ,启动非常之慢,不建议踩坑;参考链接
- Docker 官方支招:自己编译带 systemctl 服务的镜像 参考链接,
- 然而我没能测试成功在容器中启动 docker daemo
- 其他服务没尝试,感兴趣的可自行研究
- 放弃在容器中使用 systemctl 启动 Docker 镜像服务
第二周换 Redhad7.2 镜像
- 还是报同样的错误:直接报缺 5~8 个一级依赖包
- 后来分析不是 CentOS 和 Redhad 不同步,应该是甲方提供的 CentOS 源或系统优化或缺了一些默认的包;
第三周寄希望于甲方提供的内网源
- 协调再三给挂了源:是一个docker集群监控的源;沟通不畅,不认为挂错了源;
- 甲方老师又忙。暂停修整了一周;
第四周重整旗鼓
再三协调之后,放弃等待甲方老师的支援。决定还是自己搞。不就是一些一级依赖么,补全就是!
主要是我方火力太猛:
- 再不出活,无颜面对向兄弟们:虽然不上这些,采用笨办法也能干,但总归不忍
- 再不交付,无法上得台面解释:
- 自己选择的牛皮,哭着也要吹完,吹完美
搞定。想来想去,还是毛选里的那句话支撑了我:
自力更生,艰苦奋斗!
最近在看一行禅师的《佛陀传》,希望能从中汲取心灵的力量。《天龙八部》里扫地僧也曾说过:
只有佛法越高,慈悲之念越盛,武功绝技才能练得越我
或许我辈须工作中修行,也是这个道理!
采坑记
对,就是采坑。以下是从草稿中摘取的部分尝试:
编号 | 容器 |
---|---|
1 | docker run -it –name dc7 ailyfeng/centos7.2.1511 /bin/bash |
2 | docker run -it –name dc88 sssllc/centos7.2-jdk1.8 /bin/bash |
3 | docker run -it –name ct7 centos /bin/bash |
4 | docker run -it –privileged –name dc99 sssllc/centos7.2-jdk1.8 |
5 | docker build –rm -t centos:systemd . && docker run -it –name dr7 centos:systemd |
6 | docker run -it –name dr18 yjjy0921/redhat7.2 /bin/bash |
几个搞定依赖包的有用命令
ldd 应该是 linux 通用的命令;rpm 和 repotrack 貌似是 CentoOS 的专有命令;
编号 | 命令 | 举例 | 作用 |
---|---|---|---|
1 | ldd | ldd wkhtmltopdf not found | 就是对应的依赖包不存在,适用于二进制包(wkhtmltopdf)的命令;而需要安装的命令(docker-ce)只能通过安装报错来捕获缺失的依赖了 |
2 | rpm -ql | rpm -ql docker-ce | 查看安装的时候有哪些命令在PATH下,用这些命令去启动 |
3 | repotrack | repotrack -a x86_64 -p /usr/local/yumrepo libgudev1 | 打包下载指定架构(X86_63)所有的依赖到指定目录 |
思路:先验证再服务器落地
- 本地 pull一个CentOS7.2 的镜像
- 只下载 Docker 及其依赖不安装
- 安装验证
- 考虑用户及用户组赋权
- cp 至服务器尝试
安装 docker
内网 Linux 基础依赖
要安装 Docker 基础环境,必须满足:
- Linux内核必须大于3.10:登录内网服务器看了看,恰好3.10。够用,就不折腾了;
- 需要支持device-mapper:已支持
[[email protected] tmp] uname -r
3.10.0-327.e17.x86_64
[[email protected] tmp] ls -l /sys/class/misc/device-mapper
lrwxrwxrwx. 1 root root 0 May 20 16:17 /sys/class/misc/device-mapper -> ../../devices/virtual/misc/device-mapper
环境模拟
MacBook 上,起 CentOS7.2 容器,来验证思路;
拉取镜像,创建 repo 目录
hinaDreams:~ kangcunhua$ docker run -it --name dc88 sssllc/centos7.2-jdk1.8 /bin/bash
[[email protected] /]# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
[[email protected] /]# yum repo list
Loaded plugins: fastestmirror, ovl
No such command: repo. Please use /usr/bin/yum --help
[[email protected] /]#
[[email protected] /]# yum repolist
...
[[email protected] home]# cd /usr/local/
[email protected] local]# mkdir yumrepo
下载所需离线包
[[email protected] local]# cd yumrepo/
[[email protected] yumrepo]# yum install --downloadonly --downloaddir=/usr/local/yumrepo/ docker
安装 createrepo
[[email protected] yum.repos.d]# yum install createrepo -y
新建 docker.repo
[[email protected]5562e0ae yum.repos.d]# pwd
/etc/yum.repos.d
[[email protected] yum.repos.d]# vi docker.repo
docker.repo
[docker-yum]
name=dockeryum
baseurl=file:///usr/local/yumrepo
enable=1
gpgcheck=0
生成 repo 索引
主要是将索引生成在 /usr/local/yumrepo/repodata 目录
[[email protected] yum.repos.d]# createrepo /usr/local/yumrepo/
[[email protected] yum.repos.d]# cd /usr/local/yumrepo/
[[email protected] yumrepo]# ls
.....
docker-client-1.13.1-53.git774336d.el7.centos.x86_64.rpm repodata
.....
安装 docker 并验证
[[email protected] yumrepo]# yum --disablerepo=* --enablerepo=docker-yum install docker -y
[[email protected] yumrepo]# docker -v
Docker version 1.13.1, build 774336d/1.13.1
尝试启动 Hello-world
此时会报错:提示 docker daemon 没有启动;
[[email protected] /]# docker run hello-world
/usr/bin/docker-current: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘/usr/bin/docker-current run --help‘.
启动 docker 守护进程
使用 sysytemctl 启动服务。此时会报错,是 CentOS7.2 容器的“安全”考虑,没有启动D-Bus:虽然不那么友好;
[[email protected] /]# systemctl start docker
Failed to get D-Bus connection: Operation not permitted
在能查到的资料里,即使是官方,也没有说明 Docker Daemon 的守护命令放置在哪儿,以便我们能直接运行;
后续在安装 Docker-CE 时我找到了这个命令:使用 rpm -ql docker 查找该软件安装时在 PATH 下有哪些命令可以运行,成功找到了 Docker Daemon 所在:/usr/bin/dockerd 。详见文末参考;
直接运行 /usr/bin/dockerd
[[email protected] /]# /usr/bin/dockerd
INFO[2018-05-22T11:55:22.811053980Z] libcontainerd: started new docker-containerd process pid=53
INFO[0000] starting containerd module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
ERRO[0000] failed to change OOM score to -500 error="write /proc/53/oom_score_adj: permission denied" module=containerd
....
仍旧报错,但至少验证了离线安装的思路是正确的。只是在 CentOS7.2 容器中无法启动 Docker 守护进程;
结论
经过数轮的尝试,我们可以得出结论:
- 验证了离线安装的思路是正确的
- CentOS7.2 以及 RedHat7.2 容器中可以安装 docker 基础环境
- CentOS7.2 以及 RedHat7.2 容器中无法启动 Docker 守护进程
- 容器中无法启动 Docker 守护进程的事,不影响我们的实验目标
- 默认 yum install docker 的版本是 docker:Docker version 1.13.1
- 现在 Docker 已变成 Docker-CE:18.03.1-ce,需要验证离线安装 Docker-CE
安装 Docker-CE
梳理思路,重来
- 选择 centos7.2 基础镜像
- 配置 docker-ce 源
- 选择 downloadonly 的参数下载 docker-ce 及其依赖
- 配置本地源
- 指定本地源安装 docker-ce
- 条件有限,就不容器中起 docker 服务了
- 进内网,验证
下载 centos7.2 基础镜像
ChinaDreams:docker-systemctl kangcunhua$ docker run -it --name dc18 sssllc/centos7.2-jdk1.8 /bin/bash
[[email protected] /]#
配置 docker-ce 源
如果不配置 docker-ce 源,默认安装的是 docker1.13。大概是两年前的版本了。后续docker 官方将社区版本命名为 docker-ce。所以安装新版本,还是要配置下yum源的:这里强烈建议配置国内的,速度快。
[[email protected] /]# yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
配置后, yum search docker-ce 可以搜索到了。这时候就可以下载到指定位置:为了后续离线安装;
下载不安装:为了验证离线
[[email protected] /]# cd /usr/local
[[email protected] local]# mkdir yumrepo
[[email protected] local]# yum install --downloadonly --downloaddir=/usr/local/yumrepo/ docker-ce
配置 docker 本地源
建立索引
先安装本地 repo 索引创建工具,通过这个工具,建立索引:就是本地安装包所在目录下的 repodata 目录;
[[email protected] yumrepo]# yum install createrepo -y
[[email protected] yumrepo]# createrepo /usr/local/yumrepo/
创建源文件 docker.repo
[[email protected] yumrepo]# cd /etc/yum.repos.d
[[email protected] yum.repos.d]# vi docker.repo
[[email protected] yum.repos.d]# more docker.repo
[docker-yum]
name=dockeryum
baseurl=file:///usr/local/yumrepo
enable=1
gpgcheck=0
模拟离线安装
yum --disablerepo=* --enablerepo=docker-yum install docker-ce -y
验证安装成功
[[email protected] yum.repos.d]# docker -v
Docker version 18.03.1-ce, build 9ee9f40
启动 dockerd,报错
这个是因为容器中又启动了 Docker daemon。部分报错日志节选:
[[email protected] /]# docker -v
Docker version 18.03.1-ce, build 9ee9f40
[[email protected] /]# /usr/bin/dockerd
...
ERRO[0000] failed to change OOM score to -500 error="write /proc/53/oom_score_adj: permission denied" module=containerd
...
address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
INFO[0000] containerd successfully booted in 0.029058s module=containerd
ERRO[2018-05-22T11:55:23.265326880Z] ‘overlay2‘ is not supported over aufs
...
WARN[2018-05-22T11:55:23.353577680Z] Running modprobe xt_conntrack failed with message: ``, error: exit status 1
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.4.21: can‘t initialize iptables table `nat‘: Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)
Copy 资源出来
ChinaDreams:Desktop kangcunhua$ docker cp dc18:/usr/local/yumrepo .
ChinaDreams:Desktop kangcunhua$ docker cp dc18:/etc/yum.repos.d/docker.repo .
结论
- 验证离线安装 Docker-CE 思路成功;
- 容器中仍旧无法启动 Docker daemon;
内网离线实战
copy 资源到内网,通过ssh将依赖包传到服务器;
登录服务器
- yumrepo 放置到 /usr/local/ 目录下
- docker.repo 放置到 /etc/yum.repo.d/ 目录下
- 因为已经生成过索引了,所以无需再次运行 create repo
验证 docker 本地源
[[email protected] ~]# yum repolist #可以成功查看到docker-yum
离线安装
[[email protected] ~]# yum --disablerepo=* --enablerepo=docker-yum install docker-ce -y
报错,缺依赖包;docker-ce 相关依赖包已经全了,只是有一些 CentOS 依赖的包版本比 docker-ce 低,内网系统可能优化精简“过”了,或基础软件不完整,导致这些低版本和高版本不能和谐共处;只能根据报错信息,去笔记本下载依赖;报错信息和分析详见文末:“附:依赖包冲突和解决”;
解决依赖
依旧是回到个人笔记本,联网下载依赖包:
ChinaDreams:~ kangcunhua$ docker start dc7
dc7
[[email protected] /]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[[email protected] /]# yum clean all
[[email protected] /]# yum makecache
共计尝试两次,使用如下命令,下载补全系统依赖包:
编号 | 命令 |
---|---|
1 | repotrack -a x86_64 -p /usr/local/yumrepo docker-ce |
2 | repotrack -a x86_64 -p /usr/local/yumrepo glibc-2.17-105.e |
3 | repotrack -a x86_64 -p /usr/local/yumrepo systemd-sysv |
4 | repotrack -a x86_64 -p /usr/local/yumrepo dracut-network |
5 | repotrack -a x86_64 -p /usr/local/yumrepo libgudev1 |
6 | repotrack -a x86_64 -p /usr/local/yumrepo dracut-config-rescue |
7 | repotrack -a x86_64 -p /usr/local/yumrepo systemd-python |
8 | repotrack -a x86_64 -p /usr/local/yumrepo libstdc++ |
9 | repotrack -a x86_64 -p /usr/local/yumrepo glibc-headers |
10 | repotrack -a x86_64 -p /usr/local/yumrepo pcre-devel |
11 | repotrack -a x86_64 -p /usr/local/yumrepo gcc-c++ |
12 | repotrack -a x86_64 -p /usr/local/yumrepo glibc-devel |
13 | repotrack -a x86_64 -p /usr/local/yumrepo libtool-ltdl |
14 | repotrack -a x86_64 -p /usr/local/yumrepo libselinux-devel |
15 | repotrack -a x86_64 -p /usr/local/yumrepo libsepol-devel |
笔记本上验证
保证这些依赖包,不会导致安装失败。
[[email protected] /]# yum --disablerepo=* --enablerepo=docker-yum install docker -y
安装和配置用户权限
安装
将依赖包上传到内网服务器指定目录 /usr/local/yumrepo ;
[[email protected] ~]# yum --disablerepo=* --enablerepo=docker-yum install docker-ce -y
没有报错!
验证
[[email protected] ~]# docker -v
Docker version 18.03.1-ce, build 9ee9f40
启动服务
[[email protected] ~]# systemctl start docker
搞定!
配置用户
添加一个用户 dev,专门管理 docker。千万不要图省事,服务器上直接用 root 管理docker;容器可以;
[[email protected] ~]# cat /etc/group
[[email protected] ~]# cat /etc/group | grep docker
[[email protected] ~]# more /etc/passwd
[[email protected] ~]# gpasswd -a dev docker
[[email protected] ~]# useradd -g docker dev
[[email protected] ~]# passwd dev
[[email protected] ~]# chmod -v u+w /etc/sudoers
[[email protected] ~]# vi /etc/sudoers
[[email protected] ~]# chomod -v u-w /etc/sudoers
[[email protected] ~]# systemctl restart docker
[[email protected] ~]# docker -v
[[email protected] ~]# docker info
[[email protected] ~]# su dev
[[email protected] ~]#
安装 docker-compose
又被坑了:docker for Mac、docker for windows 安装完都自带 docker-compose,linux版本的 docker-ce 居然不带。想起来离线安装各种坑就头大,网上查了半天资料,居然是个 python 工具,要先安装 pip,o No!只好翻到 github,看看能不能源码编译安装。结果看到有 release 的下载,猜想可以直接使用。后来用下载后的文件百度,果然翻到一篇指南,可以这样搞:
方法四:离线安装
下载 docker-compose-Linux-x86_64,然后重新命名添加可执行权限即可:
笔记本验证先
ChinaDreams:Desktop kangcunhua$ docker cp ./docker-compose-Linux-x86_64.dms dc18:/usr/local/bin/docker-compose
进入容器
[[email protected] /]# cd /usr/local/bin/
[[email protected] bin]# ls
docker-compose
[[email protected] bin]# chmod +x /usr/local/bin/docker-compose
[[email protected] bin]# docker-compose -v
docker-compose version 1.21.2, build a133471
内网安装 docker-compose
同样把安装包 copy 进内网,ssh 上传到服务器
- cp 重命名到指定目录
- 赋予执行权限
- 赋予 dev:docker 也有执行权限
[[email protected] ~]# cd /usr/local/bin/
[[email protected] bin]# cp /home/dev/docker-images/docker-compose-Linux-x86_64.dms docker-compose
[[email protected] bin]# chmod +x ./docker-compose
[[email protected] bin]# docker-compose -v
[[email protected] bin]# chown -R dev:docker ./docker-compose
[[email protected] bin]# su dev
[[email protected] ~]# docker-compose -v
搞定!
后续
后续要做的事情就简单了:
- 从笔记本上 pull 镜像,然后导出
- copy 到内网上传到服务器,导入
- docker run 起镜像
- docker-compose 起多个镜像
尽情 happy 吧!
附:依赖包冲突和分析
内网离线安装碰上的依赖包问题和分析
报错
yun install docker-ce 时,提示有依赖包版本冲突or缺失;
Error: Package: systemd-sysv-219-19.el7.x86_64 (@anaconda)
Requires: systemd = 219-19.el7
Removing: systemd-219-19.el7.x86_64 (@anaconda)
systemd = 219-19.el7
Updated By: systemd-219-42.el7_4.4.x86_64 (localyum)
systemd = 219-42.el7_4.4
Error: Package: dracut-network-033-359.el7.x86_64 (@anaconda)
Requires: dracut = 033-359.el7
Removing: dracut-033-359.el7.x86_64 (@anaconda)
dracut = 033-359.el7
Updated By: dracut-033-502.el7.x86_64 (localyum)
dracut = 033-502.el7
Error: Package: libgudev1-219-19.el7.x86_64 (@anaconda)
Requires: systemd-libs = 219-19.el7
Removing: systemd-libs-219-19.el7.x86_64 (@anaconda)
systemd-libs = 219-19.el7
Updated By: systemd-libs-219-42.el7_4.4.x86_64 (localyum)
systemd-libs = 219-42.el7_4.4
Error: Package: dracut-config-rescue-033-359.el7.x86_64 (@anaconda)
Requires: dracut = 033-359.el7
Removing: dracut-033-359.el7.x86_64 (@anaconda)
dracut = 033-359.el7
Updated By: dracut-033-502.el7.x86_64 (localyum)
dracut = 033-502.el7
Error: Package: systemd-python-219-19.el7.x86_64 (@anaconda)
Requires: systemd = 219-19.el7
Removing: systemd-219-19.el7.x86_64 (@anaconda)
systemd = 219-19.el7
Updated By: systemd-219-42.el7_4.4.x86_64 (localyum)
systemd = 219-42.el7_4.4
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
看到报错的时候,内心是崩溃的。最后还是收拾心情,逐一解决了。
网上唯一可以找到的资料就是这篇离线安装 docker 包冲突,报错信息一模一样,但是帖子没有给出确定的原因和解决办法;但是给予了我信心,确实不是因为 CentOS7.2和 Redhat7.2 有底层不同,导致的这些错误,这样是无力解决的;后续解决完依赖后,我猜测原因是,甲方提供的 Redhat 或 CentOS,默认软件包安装的有问题:做了一些精简“优化”处理不了部分依赖包冲突;
后续找到了这篇文章:CentOS7.2 离线安装 docker-ce 最新版,文中指出 Docker 需要的部分软件包版本要高于 CentOS7;就是说同样的软件包,Docker 依赖的高版本的,但是 CentOS 依赖低版本的;解决办法就是找到他们,全部安装上去;
下载 libgudev1 和 systemd-sysv,是因为 centos7.2 的 libgudev1 和 systemd-sysv 依赖 systemd-219-19.el7.x86_64,而 docker-ce 需要 systemd-219-30el7.x86_64.
再次尝试
repotrack -a x86_64 解决上述依赖后(命令详见正文:解决依赖),copy 进内网,再次尝试安装 Docker-CE
Error: Package: systemd-sysv-219-19.el7.x86_64 (@anaconda)
Requires: systemd = 219-19.el7
Removing: systemd-219-19.el7.x86_64 (@anaconda)
systemd = 219-19.el7
Updated By: systemd-219-42.el7_4.4.x86_64 (localyum)
systemd = 219-42.el7_4.4
Error: Package: dracut-network-033-359.el7.x86_64 (@anaconda)
Requires: dracut = 033-359.el7
Removing: dracut-033-359.el7.x86_64 (@anaconda)
dracut = 033-359.el7
Updated By: dracut-033-502.el7.x86_64 (localyum)
dracut = 033-502.el7
Error: Package: libgudev1-219-19.el7.x86_64 (@anaconda)
Requires: systemd-libs = 219-19.el7
Removing: systemd-libs-219-19.el7.x86_64 (@anaconda)
systemd-libs = 219-19.el7
Updated By: systemd-libs-219-42.el7_4.4.x86_64 (localyum)
systemd-libs = 219-42.el7_4.4
Error: Package: dracut-config-rescue-033-359.el7.x86_64 (@anaconda)
Requires: dracut = 033-359.el7
Removing: dracut-033-359.el7.x86_64 (@anaconda)
dracut = 033-359.el7
Updated By: dracut-033-502.el7.x86_64 (localyum)
dracut = 033-502.el7
Error: Package: systemd-python-219-19.el7.x86_64 (@anaconda)
Requires: systemd = 219-19.el7
Removing: systemd-219-19.el7.x86_64 (@anaconda)
systemd = 219-19.el7
Updated By: systemd-219-42.el7_4.4.x86_64 (localyum)
systemd = 219-42.el7_4.4
解决办法就是继续回到笔记本联网下载这些依赖包;详见:“解决依赖”;
参考
直接安装 rpm 包
可以的,直接敲“rpm -ivh 包名”但是有些 rpm 包是有依赖性的,可以在命令尾端添加“–force –nodeps”,“–force”指强制“,”–nodeps“指不查找依赖性
比如”rpm -ivh *.rpm –force —nodeps“,同时,也可以使用 yum命 令,会自动解决包依赖的关系,能便于管理大量系统的更新问题,建议使用 yum
容器特权–privileged
Runtime privilege, Linux capabilities, and LXC configuration
–cap-add : Add Linux capabilities
–cap-drop : Drop Linux capabilities
–privileged=false : Give extended privileges to this container
–device=[] : Allows you to run devices inside the container without the –privileged flag.
–lxc-conf=[] : (lxc exec-driver only) Add custom lxc options –lxc-conf=”lxc.cgroup.cpuset.cpus = 0,1”
默认情况下,Docker的容器是没有特权的,例如不能在容器中再启动一个容器。这是因为默认情况下容器是不能访问任何其它设备的。但是通过”privileged”,容器就拥有了访问任何其它设备的权限。
我尝试了下,启动非常之慢:不推荐
ChinaDreams:~ kangcunhua$ docker run -it --privileged --name dc99 sssllc/centos7.2-jdk1.8 /usr/sbin/init
Welcome to CentOS Linux 7 (Core)!
[ OK ] Reached target Swap.
[ OK ] Created slice Root Slice.
[ OK ] Listening on udev Control Socket.
[ OK ] Reached target Encrypted Volumes.
[ OK ] Listening on udev Kernel Socket.
[ OK ] Listening on Delayed Shutdown Socket.
[ OK ] Listening on /dev/initctl Compatibility Named Pipe.
[ OK ] Reached target Remote File Systems.
[ OK ] Created slice User and Session Slice.
[ OK ] Created slice System Slice.
[ OK ] Created slice system-serialx2dgetty.slice.
[ OK ] Reached target Slices.
[ OK ] Listening on Journal Socket.
Mounting Debug File System...
Starting Journal Service...
Mounting FUSE Control File System...
Starting Apply Kernel Variables...
Starting Create Static Device Nodes in /dev...
Mounting Huge Pages File System...
Starting Setup Virtual Console...
[ OK ] Created slice system-getty.slice.
Starting Remount Root and Kernel File Systems...
[ OK ] Reached target Paths.
[ OK ] Mounted FUSE Control File System.
[ OK ] Mounted Debug File System.
[ OK ] Mounted Huge Pages File System.
[ OK ] Started Apply Kernel Variables.
[ OK ] Started Setup Virtual Console.
[ OK ] Started Create Static Device Nodes in /dev.
Starting udev Kernel Device Manager...
[ OK ] Started Journal Service.
[ OK ] Started udev Kernel Device Manager.
[FAILED] Failed to start Remount Root and Kernel File Systems.
See ‘systemctl status systemd-remount-fs.service‘ for details.
[ OK ] Reached target Local File Systems (Pre).
Starting Rebuild Hardware Database...
Starting Load/Save Random Seed...
Starting Flush Journal to Persistent Storage...
[ OK ] Reached target Local File Systems.
Starting Rebuild Journal Catalog...
[ OK ] Started Flush Journal to Persistent Storage.
Starting Create Volatile Files and Directories...
[ OK ] Started Load/Save Random Seed.
[ OK ] Started Rebuild Journal Catalog.
[ OK ] Started Create Volatile Files and Directories.
Starting Update UTMP about System Boot/Shutdown...
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started Rebuild Hardware Database.
Starting udev Coldplug all Devices...
Starting Update is Completed...
[ OK ] Started Update is Completed.
[ OK ] Started udev Coldplug all Devices.
[ OK ] Reached target System Initialization.
[ OK ] Reached target Timers.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
Starting LSB: Supports the direct execution of binary formats....
Starting Permit User Sessions...
[ OK ] Started D-Bus System Message Bus.
Starting D-Bus System Message Bus...
Starting Login Service...
[ OK ] Started Permit User Sessions.
Starting Cleanup of Temporary Directories...
[ OK ] Started Getty on tty1.
Starting Getty on tty1...
[ OK ] Started Cleanup of Temporary Directories.
[ OK ] Started Login Service.
[ OK ] Started LSB: Supports the direct execution of binary formats..
[ TIME ] Timed out waiting for device dev-ttyS0.device.
[DEPEND] Dependency failed for Serial Getty on ttyS0.
[ OK ] Reached target Login Prompts.
[ OK ] Reached target Multi-User System.
Starting Update UTMP about System Runlevel Changes...
[ OK ] Started Update UTMP about System Runlevel Changes.
^C^C^C^C^C^Ccc/
CentOS 安装 Docker CE
$ sudo yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
$ sudo yum-config-manager --enable docker-ce-edge
$ sudo yum makecache fast
$ sudo yum install docker-ce
知识点 rpm -ql 软件包
rpm -ql 软件包 查看安装的时候有哪些命令在 PATH 下,用这些命令去启动,这个是一种解决的方法
[[email protected] bin]# rpm -ql docker-ce
/etc/udev/rules.d/80-docker.rules
/usr/bin/docker
/usr/bin/docker-containerd
/usr/bin/docker-containerd-ctr
/usr/bin/docker-containerd-shim
/usr/bin/docker-init
/usr/bin/docker-proxy
/usr/bin/docker-runc
/usr/bin/dockerd
/usr/lib/systemd/system/docker.service
/usr/share/bash-completion/completions/docker
1月10日晚上21:00-22:00,我们会有 k8s 的一个分享会,有兴趣的朋友可以加小助手wechat:17812796384 进入直播分享群
以上是关于Docker 验证 Centos7.2 离线安装 Docker 环境的主要内容,如果未能解决你的问题,请参考以下文章