docker 安裝要求內(nèi)核大于3.10 扒接, 而centos6 機(jī)器上內(nèi)核一般是2.6 吹菱, 除了升級(jí)內(nèi)核外楣黍, 還可以安裝低版本的docker , 本文介紹docker 1.7的安裝惧互。
機(jī)器 環(huán)境
[root@node202 docker]# uname -a
Linux node202.hmbank.com 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@node202 docker]# cat /etc/system-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
添加epel源
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安裝
yum -y install docker-io
=======================================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================================
Installing:
docker-io x86_64 1.7.1-2.el6 epel 4.6 M
Installing for dependencies:
libcgroup x86_64 0.40.rc1-26.el6 base 131 k
lua-alt-getopt noarch 0.7.0-1.el6 epel 6.9 k
lua-filesystem x86_64 1.4.2-1.el6 epel 24 k
lua-lxc x86_64 1.0.11-1.el6 epel 16 k
lxc x86_64 1.0.11-1.el6 epel 124 k
lxc-libs x86_64 1.0.11-1.el6 epel 257 k
Transaction Summary
=======================================================================================================================================================================================
Install 7 Package(s)
報(bào)錯(cuò)1
Warning: '-bip' is deprecated, it will be replaced by '--bip' soon. See usage.
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
WARN[0000] You are running linux kernel version 2.6.32-573.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0.
INFO[0000] [graphdriver] using prior storage driver "devicemapper"
WARN[0000] Running modprobe bridge nf_nat failed with message: install /bin/true
install /sbin/modprobe --ignore-install bridge && /sbin/sysctl -q -w net.bridge.bridge-nf-call-arptables=0 net.bridge.bridge-nf-call-iptables=0 net.bridge.bridge-nf-call-ip6tables=0
install /bin/true
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/bridge/bridge.ko
, error: exit status 1
FATA[0000] Error starting daemon: Error initializing network controller: Error creating default "bridge" network: package not installed
modprobe bridge 報(bào)錯(cuò):
centos無法將安裝bridge內(nèi)核模塊哎媚。
報(bào)錯(cuò)2
root@node202 ~]# docker -d
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
WARN[0000] You are running linux kernel version 2.6.32-573.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0.
WARN[0009] Running modprobe bridge nf_nat failed with message: insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/llc/llc.ko
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/802/stp.ko
install /sbin/modprobe --ignore-install bridge && /sbin/sysctl -q -w net.bridge.bridge-nf-call-arptables=0 net.bridge.bridge-nf-call-iptables=0 net.bridge.bridge-nf-call-ip6tables=0
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/bridge/bridge.ko
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/ipv4/netfilter/nf_defrag_ipv4.ko
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/netfilter/nf_conntrack.ko
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/ipv4/netfilter/nf_conntrack_ipv4.ko
insmod /lib/modules/2.6.32-573.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat.ko
, error: exit status 1
WARN[0010] Your kernel does not support cgroup memory limit: mountpoint for memory not found
WARN[0010] mountpoint for cpu not found
FATA[0010] Error mounting devices cgroup: mountpoint for devices not found
原因: cgroup 在宿主機(jī)上沒有掛載 。
修改 /etc/fstab
在結(jié)尾加上 none /sys/fs/cgroup cgroup defaults 0 0
reboot服務(wù)器 喊儡。 解決拨与。
配置從私有倉庫拉取鏡像
- 修改 /etc/sysconfig/docker
最后一行添加:
DOCKER_OPTS="--insecure-registry node205:5000"
- 修改 /etc/init.d/docker
為exec添加上述運(yùn)行參數(shù) :
$exec -d $other_args $DOCKER_OPTS &>> $logfile &
- 重啟 service docker restart