centos6 安装docker

docker 安装要求内核大于3.10 , 而centos6 机器上内核一般是2.6 , 除了升级内核外, 还可以安装低版本的docker , 本文介绍docker 1.7的安装。

机器 环境

[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)

报错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 报错:
centos无法将安装bridge内核模块。

报错2

# 启动docker服务
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 在宿主机上没有挂载 。
修改 /etc/fstab
在结尾加上 none /sys/fs/cgroup cgroup defaults 0 0
reboot服务器 。 解决。

配置从私有仓库拉取镜像

    1. 修改 /etc/sysconfig/docker
      最后一行添加:
DOCKER_OPTS="--insecure-registry node205:5000"
    1. 修改 /etc/init.d/docker
      为exec添加上述运行参数 :
$exec -d $other_args $DOCKER_OPTS &>> $logfile &
  1. 重启 service docker restart

 

 

posted @ 2019-08-20 14:03  大数据老司机  阅读(5848)  评论(0编辑  收藏  举报