Centos6.10 安装docker
Centos6.10 安装docker
下载安装docker用到的依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos-vault/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
尝试其他镜像。
http://mirrors.aliyun.com/centos-vault/centos/6/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
尝试其他镜像。
http://mirrors.aliyun.com/centos-vault/centos/6/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
尝试其他镜像。
包 yum-utils-1.1.30-42.el6_10.noarch 已安装并且是最新版本
包 device-mapper-persistent-data-0.6.2-0.2.rc7.el6.x86_64 已安装并且是最新版本
包 lvm2-2.02.143-12.el6_9.1.x86_64 已安装并且是最新版本
无须任何处理
为yum源添加docker仓库位置
即下载Docker的镜像源 如果不设置,默认会从官网下载,访问速度比较慢
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
docker-ce.repo | 2.0 kB 00:00
repo saved to /etc/yum.repos.d/docker-ce.repo
我配置了docker仓库后又回到了原来的报错,如果报错了把资源docker-ce-stable禁用了就好了,具体的查看yum-config-manager相关
接下来就是安装docker
yum install -y docker-ce
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
No package docker-ce available.
错误:无须任何处理
然后就会出现上面这种错误,网上针对此场景给出了一些办法,但是尝试一遍后发现,没有起作用。不过好的一点就是,下载到了安装包
执行以下命令:
yum install -y epel-release
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
解决依赖关系
--> 执行事务检查
---> Package epel-release.noarch 0:6-8 will be 安装
--> 完成依赖关系计算
依赖关系解决
=============================================================================================================================================================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================================================================================================================================================
正在安装:
epel-release noarch 6-8 extras 14 k
事务概要
=============================================================================================================================================================================================================================================
Install 1 Package(s)
总下载量:14 k
Installed size: 22 k
下载软件包:
epel-release-6-8.noarch.rpm | 14 kB 00:00
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : epel-release-6-8.noarch 1/1
warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
Verifying : epel-release-6-8.noarch 1/1
已安装:
epel-release.noarch 0:6-8
完毕!
接着
yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
已加载插件:fastestmirror
设置安装进程
docker-engine-1.7.1-1.el6.x86_64.rpm | 4.5 MB 00:00
诊断 /var/tmp/yum-root-X3enAq/docker-engine-1.7.1-1.el6.x86_64.rpm: docker-engine-1.7.1-1.el6.x86_64
/var/tmp/yum-root-X3enAq/docker-engine-1.7.1-1.el6.x86_64.rpm 将被安装
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
解决依赖关系
--> 执行事务检查
---> Package docker-engine.x86_64 0:1.7.1-1.el6 will be 安装
--> 完成依赖关系计算
依赖关系解决
=============================================================================================================================================================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================================================================================================================================================
正在安装:
docker-engine x86_64 1.7.1-1.el6 /docker-engine-1.7.1-1.el6.x86_64 19 M
事务概要
=============================================================================================================================================================================================================================================
Install 1 Package(s)
总文件大小:19 M
Installed size: 19 M
确定吗?[y/N]:y
下载软件包:
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : docker-engine-1.7.1-1.el6.x86_64 1/1
Verifying : docker-engine-1.7.1-1.el6.x86_64 1/1
已安装:
docker-engine.x86_64 0:1.7.1-1.el6
完毕!
这里已经成功安装docker了!
我们再仔细看下诊断这个位置,提到了一个目录(/var/tmp/yum-root-X3enAq/)
yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
已加载插件:fastestmirror
设置安装进程
docker-engine-1.7.1-1.el6.x86_64.rpm | 4.5 MB 00:00
诊断 /var/tmp/yum-root-X3enAq/docker-engine-1.7.1-1.el6.x86_64.rpm: docker-engine-1.7.1-1.el6.x86_64
/var/tmp/yum-root-X3enAq/docker-engine-1.7.1-1.el6.x86_64.rpm:不更新已安装的软件包。
错误:无须任何处理
cd /var/tmp/yum-root-X3enAq/
ll 总用量 4652 -rw-r--r--. 1 root root 4762280 10月 17 2018 docker-engine-1.7.1-1.el6.x86_64.rpm
原来安装包就是被下载到这里了
yum install docker-engine-1.7.1-1.el6.x86_64.rpm
已加载插件:fastestmirror
设置安装进程
诊断 docker-engine-1.7.1-1.el6.x86_64.rpm: docker-engine-1.7.1-1.el6.x86_64
docker-engine-1.7.1-1.el6.x86_64.rpm:不更新已安装的软件包。
尝试用yum来安装,发现不可行。
rpm -q libcgroup
libcgroup-0.40.rc1-27.el6_10.x86_64
挂载
在/etc路径下有一个文件叫fstab,修改成如下形式(主要是添加最后一行内容)
cat fstab
#
# /etc/fstab
# Created by anaconda on Fri Apr 8 21:35:00 2022
#
# 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/vg_lrj-lv_root / ext4 defaults 1 1
UUID=e9a808a1-18cc-4e67-9b16-0055d736aea5 /boot ext4 defaults 1 2
/dev/mapper/vg_lrj-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
启动cgroup并查看启动状态
service cgconfig start
Starting cgconfig service: [确定]
service cgconfig status
Running
然后我们再去安装包所在的目录
cd /var/tmp/yum-root-X3enAq/
执行命令
rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
package docker-engine-1.7.1-1.el6.x86_64 is already installed
最后,达到了我们想要的结果,即在CentOS 6.10 环境下安装docker!
docker -v
Docker version 1.7.1, build 786b29d
启动docker
网上很多教程说需要执行这个命令
systemctl start docker bash: systemctl: command not found
换成如下命令
service docker start Starting docker: [确定]
验证是否安装成功
docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
Pool Name: docker-253:0-913306-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 305.7 MB
Data Space Total: 107.4 GB
Data Space Available: 11.83 GB
Metadata Space Used: 729.1 kB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.147 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.117-RHEL6 (2016-12-13)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 2.6.32-754.el6.x86_64
Operating System: <unknown>
CPUs: 2
Total Memory: 1.834 GiB
Name: lrj
ID: LBEE:WV42:KFYS:DDY3:27LR:ORKZ:S6D7:46RP:T4H4:P6RM:RGDH:C56W