1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | Docker Network 配置,自定义bridge网络 1. 停止服务 service docker stop 2. 关掉docker0 ifconfig docker0 down 3. 删除docker brctl delbr docker0 4. 增加网桥br500 yum install bridge - utils 2 , 网络配置 [root@AthController53 network - scripts] # cat ifcfg-br500 DEVICE = br500 ONBOOT = yes NM_CONTROLLED = no BOOTPROTO = static TYPE = Bridge IPADDR = 10.14 . 23.1 NETMASK = 255.255 . 255.0 [root@AthController53 network - scripts] # cat ifcfg-p3p2 DEVICE = p3p2 ONBOOT = yes NM_CONTROLLED = no BOOTPROTO = static BRIDGE = br500 3 ,重启网卡 service netowrk restart 5 , 查看网络信息 ip addr show bridge0 查看路由信息:route - n 查看网桥信息: brctl show 6. 加入变量: #Centos 6.5 配置,系统版本不一样,配置也不一样 vim / etc / sysconfig / docker other_args = "-b=br500" 7 , 启动docker服务 service docker start 8. 启动docker容器 service docker restart 9 , 日志相关信息 2014 / 10 / 08 10 : 31 : 55 WARNING: You are running linux kernel version 2.6 . 32 - 431.29 . 2.el6 .x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8 . 0. 2014 / 10 / 08 10 : 31 : 55 docker daemon: 1.1 . 2 d84a070 / 1.1 . 2 ; execdriver: native; graphdriver: [ 11c90a98 ] + job serveapi(unix: / / / var / run / docker.sock) [ 11c90a98 ] + job initserver() [ 11c90a98 .initserver()] Creating server 2014 / 10 / 08 10 : 31 : 55 Listening for HTTP on unix ( / var / run / docker.sock) [ 11c90a98 ] + job init_networkdriver() [ 11c90a98 .init_networkdriver()] bridge not found: bridge500 net: no such interface [ 11c90a98 ] - job init_networkdriver() = ERR ( 1 ) net: no such interface [ 11c90a98 ] - job initserver() = ERR ( 1 ) 2014 / 10 / 08 10 : 31 : 55 net: no such interface \n2014年 10 月 08 日 星期三 10 : 52 : 55 CST\n 2014 / 10 / 08 10 : 52 : 55 WARNING: You are running linux kernel version 2.6 . 32 - 431.29 . 2.el6 .x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8 . 0. 2014 / 10 / 08 10 : 52 : 55 docker daemon: 1.1 . 2 d84a070 / 1.1 . 2 ; execdriver: native; graphdriver: [dabc6783] + job serveapi(unix: / / / var / run / docker.sock) [dabc6783] + job initserver() [dabc6783.initserver()] Creating server 2014 / 10 / 08 10 : 52 : 55 Listening for HTTP on unix ( / var / run / docker.sock) [dabc6783] + job init_networkdriver() [dabc6783] - job init_networkdriver() = OK ( 0 ) Loading containers: : done. [dabc6783.initserver()] Creating pidfile [dabc6783.initserver()] Setting up signal traps [dabc6783] - job initserver() = OK ( 0 ) [dabc6783] + job acceptconnections() [dabc6783] - job acceptconnections() = OK ( 0 ) 2014 / 10 / 08 10 : 53 : 17 GET / v1. 13 / images / json [dabc6783] + job images() [dabc6783] - job images() = OK ( 0 ) |
本文转自 swq499809608 51CTO博客,原文链接:http://blog.51cto.com/swq499809608/1561155