1. 创建网桥(也就是虚拟交换机)
docker network create --driver bridge --subnet 192.168.100.0/24 docker01
//docker01是可以自定义的 --subnet网段也是可以自定义的
2. 指定交换机创建容器
docker run -it --network docker01 centos
//创建出来的容器ip地址就是docker01设定的网段地址
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis