zoukankan      html  css  js  c++  java
  • 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

     

  • 相关阅读:
    使用MySQL存储过程连续插入多条记录
    为什么编程语言以及数据库要从1970年1月1日开始计算时
    关于shtml页面include问题解决方案
    简单实用的FTP操作类
    js实现完美身份证号有效性验证
    .htaccess文件的建立和rewrite_module的启用
    php冒泡排序
    php实现汉诺塔问题(递归)
    简单的mysql数据库备份程序
    选择排序的php实现
  • 原文地址:https://www.cnblogs.com/liugp/p/11382533.html
Copyright © 2011-2022 走看看