centos6上玩docker

只需要如下操作即可:

1.#cd /etc/yum.repos.d/
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 
#rpm -ivh http://mirrors.aliyun.com/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
2. yum更新

#yum clean all && yum makecache && yum update -y

3.安装docker并启动docker服务
#yum install docker-io
#service docker start

但是这样的docker文件系统是有问题的,
[root@jboss ~]# docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
Pool Name: docker-253:0-5112199-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
Metadata Space Used: 733.2 kB
Metadata Space Total: 2.147 GB
Udev Sync Supported: true
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Kernel Version: 2.6.32-358.el6.x86_64
Operating System: <unknown>
CPUs: 16
Total Memory: 70.75 GiB
Name: jboss

注意 Data file: /dev/loop0,docker的文件存储是用loop循环块设备模式进行挂载读写,今后扩容很是麻烦。

所以最后还是升级内核3.10后进行操作

升级内核,只需要4步:

#cd /etc/yum.repos.d
#wget http://www.hop5.in/yum/el6/hop5.repo
#yum install kernel-ml-aufs kernel-ml-aufs-devel -y
#修改grub.conf启动内核3.10 && reboot

再继续玩!

Containers: 0
Images: 0
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.10.5-3.el6.x86_64
Operating System: <unknown>
CPUs: 24
Total Memory: 11.81 GiB

Storage Driver: aufs 看见了吗?

 

/etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

服务器维护 服务器配置 服务器 维护 运维 网管 系统调优 网络调优 数据库优化