centos6离线安装docker

参考 RedHat 6.8 离线安装Docker (rpm包安装) - 神奇二进制 - 博客园 (cnblogs.com)

可参考,但本次安装未参考 CentOS6 完全离线安装Docker - 简书 (jianshu.com)

走了一遍,大雾 (1条消息) 离线安装Docker_洒家肉山大魔王的博客-CSDN博客

在内网安装docker,一开始走了很多弯路,比如下载docker安装包,直接安装

1、替换linux镜像

^C[root@rocketmq-nameserver2 ~]# vi /etc/yum.repos.d/CentOS-Base.repo You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 ~]# yum clean all 已加载插件:fastestmirror, refresh-packagekit, security Cleaning repos: base docker-ce-stable epel extras updates 清理一切 Cleaning up list of fastest mirrors [root@rocketmq-nameserver2 ~]# yum makecache 已加载插件:fastestmirror, refresh-packagekit, security Determining fastest mirrors epel/metalink | 4.7 kB 00:00 * epel: ftp.iij.ad.jp base | 3.7 kB 00:00 base/group_gz | 242 kB 00:00 base/filelists_db | 6.4 MB 00:01 base/primary_db | 4.7 MB 00:00 base/other_db | 2.8 MB 00:00 https://download.docker.com/linux/centos/6/x86_64/stable/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 尝试其他镜像。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. 错误:Cannot retrieve repository metadata (repomd.xml) for repository: docker-ce-stable. Please verify its path and try again [root@rocketmq-nameserver2 ~]# yum repolist 已加载插件:fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile epel/metalink | 4.7 kB 00:00 * epel: ftp.iij.ad.jp https://download.docker.com/linux/centos/6/x86_64/stable/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 尝试其他镜像。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. https://download.docker.com/linux/centos/6/x86_64/stable/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 尝试其他镜像。 epel | 4.7 kB 00:00 epel/primary_db | 6.1 MB 00:01 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 12 MB 00:03 仓库标识 仓库名称 状态 base CentOS-6.10 - Base - vault.centos.org 6,713 docker-ce-stable Docker CE Stable - x86_64 0 epel Extra Packages for Enterprise Linux 6 - x86_64 12,581 extras CentOS-6.10 - Extras - vault.centos.org 47 updates CentOS-6.10 - Updates - vault.centos.org 1,193 repolist: 20,534 You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 ~]# yum -y install docker 已加载插件:fastestmirror, refresh-packagekit, security 设置安装进程 Loading mirror speeds from cached hostfile * epel: ftp.iij.ad.jp https://download.docker.com/linux/centos/6/x86_64/stable/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 尝试其他镜像。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a

 

[root@rocketmq-nameserver2 ~]# ls 2 as.sh docker Documents install.log mongodb-linux-x86_64-3.4.6.tgz nohup.out Public Videos anaconda-ks.cfg Desktop docker-19.03.9.tgz Downloads install.log.syslog Music Pictures Templates [root@rocketmq-nameserver2 ~]# cp -p docker/* /usr/bin [root@rocketmq-nameserver2 ~]# cd /usr/lib/systemd/system/ -bash: cd: /usr/lib/systemd/system/: 没有那个文件或目录 You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 ~]# cd /usr/lib/ [root@rocketmq-nameserver2 lib]# ls anaconda-runtime cups java java-1.4.1 java-1.6.0 java-ext jvm-exports libfdfsclient.so lsb rpm yum-plugins bonobo games java-1.3.1 java-1.4.2 java-1.7.0 jvm jvm-private libWeWorkFinanceSdk_Java.so mozilla sendmail ConsoleKit gcc java-1.4.0 java-1.5.0 java-1.8.0 jvm-commmon libfastcommon.so locale python2.6 sendmail.postfix [root@rocketmq-nameserver2 lib]# pwd /usr/lib [root@rocketmq-nameserver2 lib]# mkdir systemd [root@rocketmq-nameserver2 lib]# cd systemd/ [root@rocketmq-nameserver2 systemd]# mkdir system You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 systemd]# cd system/ [root@rocketmq-nameserver2 system]# ls [root@rocketmq-nameserver2 system]# vim /usr/lib/systemd/system/docker.service You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 system]# vim /usr/lib/systemd/system/docker.service

以上弯路是照着centos7版本离线安装docker的方式进行安装,报错很多

2、systemctl命令找不到,替换为chkconfig

 

3、找不到systemd文件夹,自建文件夹,仍然启动不起来,都是因为centos7版本与centos6版本不同导致的。

[root@rocketmq-nameserver2 system]# yum remove docker 已加载插件:fastestmirror, refresh-packagekit, security 设置移除进程 参数 docker 没有匹配 Loading mirror speeds from cached hostfile * epel: ftp.iij.ad.jp https://download.docker.com/linux/centos/6/x86_64/stable/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 尝试其他镜像。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. 错误:Cannot retrieve repository metadata (repomd.xml) for repository: docker-ce-stable. Please verify its path and try again You have mail in /var/spool/mail/root

4、清理掉之前自建的文件夹,之后,根据 RedHat 6.8 离线安装Docker (rpm包安装) - 神奇二进制 - 博客园 (cnblogs.com) 文档下载安装包

 

5、编辑/etc/fstab

 

修改为

# # /etc/fstab # Created by anaconda on Wed Jun 7 03:12:56 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/VolGroup-lv_root / ext4 defaults 1 1 UUID=de5a45b3-0ad7-4503-a353-ba02d9b3913d /boot ext4 defaults 1 2 /dev/mapper/VolGroup-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 none /cgroup cgroup defaults 0 0

6、安装必要的组建

[root@rocketmq-nameserver2 ~]# cd rpm/ [root@rocketmq-nameserver2 rpm]# ls device-mapper-libs-1.02.117-12.el6_9.1.i686.rpm epel-release-6-8.noarch.rpm lua-filesystem-1.4.2-1.el6.x86_64.rpm lxc-libs-1.0.11-1.el6.x86_64.rpm device-mapper-libs-1.02.117-12.el6_9.1.x86_64.rpm libcgroup-0.40.rc1-27.el6_10.x86_64.rpm lua-lxc-1.0.11-1.el6.x86_64.rpm docker-io-1.7.1-2.el6.x86_64.rpm lua-alt-getopt-0.7.0-1.el6.noarch.rpm lxc-1.0.11-1.el6.x86_64.rpm [root@rocketmq-nameserver2 rpm]# rpm -ivh epel-release-6-8.noarch.rpm Preparing... ########################################### [100%] package epel-release-6-8.noarch is already installed [root@rocketmq-nameserver2 rpm]# rpm -ivh lxc-libs-1.0.11-1.el6.x86_64.rpm --force --nodeps Preparing... ########################################### [100%] 1:lxc-libs ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh lua-alt-getopt-0.7.0-1.el6.noarch.rpm Preparing... ########################################### [100%] 1:lua-alt-getopt ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh lua-filesystem-1.4.2-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:lua-filesystem ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh lua-lxc-1.0.11-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:lua-lxc ########################################### [100%] You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 rpm]# rpm -ivh lxc-1.0.11-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:lxc ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh docker-io-1.7.1-2.el6.x86_64.rpm --force --nodeps Preparing... ########################################### [100%] 1:docker-io ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh device-mapper-libs-1.02.117-12.el6_9.1.i686.rpm --force --nodeps Preparing... ########################################### [100%] 1:device-mapper-libs ########################################### [100%] [root@rocketmq-nameserver2 rpm]# rpm -ivh device-mapper-libs-1.02.117-12.el6_9.1.x86_64.rpm --force --nodeps Preparing... ########################################### [100%] 1:device-mapper-libs ########################################### [100%]

但是启动时报 挂载错误,

[root@rocketmq-nameserver2 rpm]# service docker start Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy /sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d [FAILED] Starting docker: [ OK ] [root@rocketmq-nameserver2 rpm]# vi /etc/fstab You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 rpm]# service docker restart Stopping docker: [FAILED] Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy /sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d [FAILED] Starting docker: [ OK ] [root@rocketmq-nameserver2 rpm]# ls /cgroup/cpu/ cgroup.event_control cpu.cfs_period_us cpu.rt_period_us cpu.shares easyops release_agent cgroup.procs cpu.cfs_quota_us cpu.rt_runtime_us cpu.stat notify_on_release tasks You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 rpm]# vi /etc/fstab [root@rocketmq-nameserver2 rpm]# service docker restart Stopping docker: [FAILED] Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy /sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d [FAILED] Starting docker: [ OK ]

处理方式是 cpu = /cgroup/cpu; memory = /cgroup/memory; 这两个配置注解

[root@rocketmq-nameserver2 rpm]# cat /etc/cgconfig.conf # # Copyright IBM Corporation. 2007 # # Authors: Balbir Singh <balbir@linux.vnet.ibm.com> # This program is free software; you can redistribute it and/or modify it # under the terms of version 2.1 of the GNU Lesser General Public License # as published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See man cgconfig.conf for further details. # # By default, mount all controllers to /cgroup/<controller> mount { cpuset = /cgroup/cpuset; cpu = /cgroup/cpu; cpuacct = /cgroup/cpuacct; memory = /cgroup/memory; devices = /cgroup/devices; freezer = /cgroup/freezer; net_cls = /cgroup/net_cls; blkio = /cgroup/blkio; } You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 rpm]# vim /etc/cgrules.conf [root@rocketmq-nameserver2 rpm]# vim /etc/cgconfig.conf You have mail in /var/spool/mail/root [root@rocketmq-nameserver2 rpm]# service docker start Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy /sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d [FAILED] Starting docker: [ OK ] [root@rocketmq-nameserver2 rpm]# vim /etc/cgconfig.conf [root@rocketmq-nameserver2 rpm]# service docker start Starting cgconfig service: [ OK ] Starting docker: [ OK ]

验证docker安装已经成功

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值