docker pipework 设置网络

1.设置主机为桥接状态
cd /etc/sysconfig/network-scripts/; cp ifcfg-eth0  ifcfg-br0
vi ifcfg-eth0 //增加BRIDGE=br0,删除IPADDR,NETMASK,GATEWAY,DNS1
vi ifcfg-br0//修改DEVICE为br0,Type为Bridge,把eth0的网络设置设置到这里来
service network restart

2.安装pipwork:  git clone https://github.com/jpetazzo/pipework 
cp ~/pipework/pipework /usr/local/bin/

3.开启一个容器: docker run -itd --net=none --name=centos6  treasureboat/centos6  /bin/bash

4.安装相关包
  rpm -Uvh https://repos.fedorapeople.org/openstack/EOL/openstack-grizzly/epel-6/iproute-2.6.32-130.el6ost.netns.2.x86_64.rpm #不安会报错Object "netns" is unknown, try "ip help"

5.配置网络
pipework br0 centos6 192.168.32.106/[email protected]
docker exec -it  centos6   /bin/bash 

你可能感兴趣的:(docker pipework 设置网络)