centos6.2 64 部署docker-阿里云开发者社区

开发者社区> 开发与运维> 正文

centos6.2 64 部署docker

简介:

centos6.2 64 部署docker


安装docker yum源:

yum install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm


[root@yz6245 yum.repos.d]#  yum install docker-io

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again


解决:

修改repo:https 改为http

yum install docker-io


# docker  version

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d/1.7.1

OS/Arch (client): linux/amd64

Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?




service docker start

启动成功

#service docker start 这里等价于docker -d 


docker -d  有报错:

[root@yz6245 yum.repos.d]# docker  -d

WARN[0000] You are running linux kernel version 2.6.32-220.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 

docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference



解决:

yum install device-mapper-libs

安装成功后还是同样错误,对比在centos6.5上部署的环境,发现device-mapper-libs版本低,故进行了手动rpm安装。

升级高版本后解决。

依赖包:

yum install libudev-devel.x86_64




wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-1.02.117-7.el6.x86_64.rpm            

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-devel-1.02.117-7.el6.i686.rpm        

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-devel-1.02.117-7.el6.x86_64.rpm      

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-event-1.02.117-7.el6.x86_64.rpm      

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-event-devel-1.02.117-7.el6.i686.rpm  

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-event-devel-1.02.117-7.el6.x86_64

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-event-libs-1.02.117-7.el6.i686.rpm   

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-event-libs-1.02.117-7.el6.x86_64.rpm 

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-libs-1.02.117-7.el6.i686.rpm         

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/device-mapper-libs-1.02.117-7.el6.x86_64.rpm  


 

 

[root@yz6245 device-mapper]# service docker restart 

Stopping docker:                                           [FAILED]

Starting docker:                                    [  OK  ]

[root@yz6245 device-mapper]# docker -d

WARN[0000] You are running linux kernel version 2.6.32-220.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 

INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 

ERRO[0000] [graphdriver] prior storage driver "devicemapper" failed: Error running DeviceCreate (CreatePool) dm_task_run failed 

FATA[0000] Error starting daemon: error initializing graphdriver: Error running DeviceCreate (CreatePool) dm_task_run failed 


还是报错,网上说可能是磁盘空间问题,发现没有异常。

[root@yz6245 device-mapper]# 

[root@yz6245 device-mapper]# df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda1             41284736   7586236  31601360  20% /

tmpfs                  1896576         0   1896576   0% /dev/shm

/dev/vda1            309627260    195416 293703700   1% /data0

[root@yz6245 device-mapper]# ll /var/lib/docker/

total 8

drwx------ 4 root root 4096 Sep 22 20:17 devicemapper

drwx------ 2 root root 4096 Sep 22 19:27 tmp

[root@yz6245 device-mapper]# rm -rf  /var/lib/docker/*

[root@yz6245 device-mapper]# service docker restart 

Stopping docker:                                           [FAILED]

Starting docker:                                    [  OK  ]

[root@yz6245 device-mapper]# docker -d

WARN[0000] You are running linux kernel version 2.6.32-220.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 

ERRO[0000] [graphdriver] prior storage driver "devicemapper" failed: Error running DeviceCreate (CreatePool) dm_task_run failed 

FATA[0000] Error starting daemon: error initializing graphdriver: Error running DeviceCreate (CreatePool) dm_task_run failed 




-s 是指定使用的文件系统,默认是devicemapper 也可以是vfs 或aufs(ubuntu的)

**  启动docker-daemon不成功,可能是我的线上机器是虚拟机的问题所以加上 -s vfs 就启动成功了。**


#如果要追加参数请修改/etc/sysconfig/docker 这个文件 如:加入other_args=" -s vfs"




[root@yz6245 device-mapper]# docker -d -s vfs 

WARN[0000] You are running linux kernel version 2.6.32-220.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 

INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 

WARN[0000] Running modprobe bridge nf_nat failed with message: , error: exit status 1 

WARN[0000] Your kernel does not support oom control.    

INFO[0000] Loading containers: start.                   


INFO[0000] Loading containers: done.                    

INFO[0000] Daemon has completed initialization          

INFO[0000] Docker daemon                                 commit=786b29d/1.7.1 ex




#到目前为止已经能正常pull镜像,但是无法正常运行container。

[root@yz6245 ~]# docker  images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

commonms/ansible    latest              b3e0a9dd686a        2 days ago          469.2 MB

[root@yz6245 ~]# docker  run -i -t  commonms/ansible  /bin/bash

...

...

一直卡住不动。待解决。



本文转自 Wilson9527 51CTO博客,原文链接:http://blog.51cto.com/devops9527/1855712,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章