1.桥接物理网卡:
首先下载工具:
yum -y install --enablerepo=epel bridge-utils
停止服务:
983 systemctl stop docker
删除docker0网卡
984 ip link set dev docker0 down
985 brctl delbr docker0
新建桥接物理网络虚拟网卡br0:
986 brctl addbr br0
987 ip link set dev br0 up
启用新的网卡br0:
988 ip addr add 192.168.36.100/24 dev br0
查看网卡信息:
ip addr show br0
设置docker服务启动参数:
cat /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd-current --selinux-enabled -b=br0
启动docker服务
systemctl daemon-reload
systemctl start docker
制作镜像并实验成功:
989 docker images
990 docker load -i centos7cg.tar
991 docker images
992 bash -c "curl https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework > /usr/local/bin/pipework"
993 chmod +x /usr/local/bin/pipework
994 pipework br0 $(/usr/bin/docker run -d ff37bc5ab732) 192.168.36.12/24@192.168.36.2
995 docker ps
996 ping 192.168.36.12
997 ps -ef|grep docker run -it
998 ps -ef|grep docker
999 kill -9 4711
1000 docker ps
1001 docker exec -it bendi1 /bin/bash
当然这里会出现问题:
有两个网卡所以启动的额时候不要分配ip:
eg:
docker run -it --rm --net=none --name bendi1 ff37bc5ab732 /bin/bash
成功!!!
首先配置桥接网络:
[root@node network-scripts]# cat ifcfg-eno16777736
DEVICE=eno16777736
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
BRIDGE=virbr0
[root@node network-scripts]# cat ifcfg-virbr0
DEVICE="virbr0"
BOOTPROTO="static"
IPADDR="192.168.36.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.36.2"
DNS1=61.139.2.69
ONBOOT="yes"
TYPE="Bridge"
NM_CONTROLLED="no
[root@node network-scripts]#
用pipwork建容器:
1019 docker run -it --rm --net=none --name bendi1 ff37bc5ab732 /bin/bash
1020 docker ps
1021 docker ps -a
1022 docker run -it -d --net=none --name bendi1 ff37bc5ab732 /bin/bash
1023 docker ps -a
1024 ip addr
1025 pipework virbr0 benji1 192.168.36.15/24
1026 pipework virbr0 bendi1 192.168.36.15/24
1027 docker exec -it bendi1 /bin/bash
1028 ping www.baidu.com
1029 docker exec -it bendi1 /bin/bash
1030 docker run -it -d --net=none --name bendi11 ff37bc5ab732 /bin/bash
1031 pipework virbr0 bendi1 192.168.36.15/24@192.168.36.2
1032 pipework virbr0 bendi11 192.168.36.15/24@192.168.36.2
1033 docker stop bendi1
1034 docker exec -it bendi11 /bin/bash
好了,现在桥接网络成功!!!!
安装docker+salt minion:
好了,一起玩docker+salt,先说玩ansible的,结果一个坑队友说那个反应迟钝,所以选择玩salt!!!!!!