docker 桥接网络

版权声明:hanxinkong提供技术支持 https://blog.csdn.net/hanxinkong/article/details/87577755

复制网卡配置文件ifcfg-ens33为ifcfg-br0,修改ifcfg-br0

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-ens33 ifcfg-br0
# vim ifcfg-br0 //修改TYPE,NAME,DEVICE

修改网卡配置文件

//删除UUID,IPADDR,NETMASK,GATEWAY,DNS
//增加 BRIDGE=br0
# vim ifcfg-ens33

重启网卡服务

# systemctl restart network

安装pipwork

# yum install git -y
# git clone https://github.com/jpetazzo/pipework

复制pipwork到 /usr/local/bin/

# cp pipework /usr/local/bin/


# docker run -itd --net=none  --privileged  centos init    //带权限运行容器
 
# pipework br0 20e32851 192.168.2.150/[email protected]

# docker exec -it 20e32851 /bin/bash

猜你喜欢

转载自blog.csdn.net/hanxinkong/article/details/87577755