CentOS-6.5离线安装docker-1.7教程
0. 准备
本文是模拟实际上线时,没有网络的情况下使用rpm包安装docker-1.7的方法。不过安装中也是使用yum,相比较直接使用rpm安装,yum可以解决一些库文件的依赖关系。
# cd /etc/yum.repos.d/
# mkdir bak
# mv * bak/
1. 安装libcgroup
# cd cgroup/
# yum installlibcgroup-0.40.rc1-16.el6.x86_64.rpm
2. 安装lxc
# yum installlua-filesystem-1.4.2-1.el6.x86_64.rpm lua-alt-getopt-0.7.0-1.el6.noarch.rpmlxc-libs-1.0.7-2.el6.x86_64.rpm lxc-1.0.7-2.el6.x86_64.rpmlua-lxc-1.0.7-2.el6.x86_64.rpm
3. 安装docker
# yum installdocker-io-1.7.1-2.el6.x86_64.rpm
4. 更新device-mapper-libs
# yum installdevice-mapper-*
5.
设置开机自启
# chkconfig docker on
6.
检查支持情况
# lxc-checkconfig
7.
启动cgroup
# service cgconfig start
8. 启动docker
9. 测试
# docker ps –a
10. 常见错误
l 启动docker报错,错误log:
INFO[0000] +jobserveapi(unix:///var/run/docker.sock)
INFO[0000] Listening forHTTP on unix (/var/run/docker.sock)
INFO[0000] WARNING: You arerunning linux kernel version 2.6.32-504.8.1.el6.x86_64, which might be unstablerunning docker. Please upgrade your kernel to 3.8.0.
docker: relocationerror: docker: symbol dm_task_get_info_with_deferred_remove, version Base notdefined in file libdevmapper.so.1.02 with link time reference
原因:是因为libdevmapper版本太旧,需要update。执行步骤4即可。
l 启动docker出错,错误log为:
[root@csv-bdyx01yum.repos.d]# docker -d &
[1] 7449
[root@csv-bdyx01yum.repos.d]# WARN[0000] You are running linux kernel version2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgradeyour kernel to 3.10.0.
INFO[0000] [graphdriver]using prior storage driver "devicemapper"
INFO[0000] Listening forHTTP on unix (/var/run/docker.sock)
WARN[0000] Running modprobebridge nf_nat failed with message: , error: exit status 1
WARN[0000] Yourkernel does not support cgroup memory limit: mountpoint for memory not found
WARN[0000]mountpoint for cpu not found
FATA[0000] Errormounting devices cgroup: mountpoint for devices not found
原因:cgconfig未启动。执行步骤7即可。