Docker网络模式与配置Docker自定义网络(bridge模式(4)

查看容器的状态,进入容器查看ip地址

[root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 683ad76f7789 centos:7 "/bin/bash" 23 seconds ago Up 22 seconds test2 [root@localhost ~]# docker exec -it 683ad76f7789 /bin/bash [root@683ad76f7789 /]# yum install -y net-tools Loaded plugins: fastestmirror, ovl ... [root@683ad76f7789 /]# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.18.0.10 netmask 255.255.255.0 broadcast 172.18.0.255 ether 02:42:ac:12:00:0a txqueuelen 0 (Ethernet) RX packets 2302 bytes 15050471 (14.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2049 bytes 113777 (111.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1000 (Local Loopback) RX packets 62 bytes 7019 (6.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 62 bytes 7019 (6.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

此时发现自定义的网络设置容器ip地址成功了。

四、总结

​ 本文通过对VMware软件中的三种网络模式工作的原理,层层递进深入讲解docker的各种网络模式,并且通过案例结合排障思路详细介绍了有关docker网桥模式是如何配置容器ip地址的,有默认模式以及自定义模式。

​最后,需要注意的是命令还是需要多记多敲多练,谢谢阅读!

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/34b353ce210c4b2225d05410c0acba27.html