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

...

...

一直卡住不动。待解决

猜你在找的CentOS相关文章