Docker 1.12 allows the container to use the same network segment as the host

Due to some special requirements of development, the container needs to be deployed in the same network segment as the host. The deployment steps are as follows:

Step 1: Create a network

$ docker network create -d macvlan --subnet=172.16.0.0/24 --gateway= 172.16.0.1 -o parent=eno16777736 mynet
548d79fe04c613d3ca180e86 89f2207f71534020bc39566d 62d0b5aeb67fc8b5

Parameter resolution:
-d macvlan   loads the module name of the kernel
--subnet The network segment where the host is located --Inherit the network segment where the specified
gateway segment is located The network segment gateway -parent Two: run the container $ docker run --net=mynet --ip=172.16.0.100 -it -d --rm centos:6.7 /bin/bash Parameter analysis: --ip can specify the IP of the container






 

http://blog.sina.com.cn/s/blog_13ea37b210102x03x.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326794632&siteId=291194637