Docker for Mac container IP configuration issues

  docker, question
  1. Host Mac related information

    en0: inet netmask 0xffffff00 broadcast
  2. Docker for Mac related information

    # ip addr show eth0
     4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
     link/ether c0:ff:ee:c0:ff:ee brd ff:ff:ff:ff:ff:ff
     inet brd scope global eth0
  3. Create macvlan networks and containers

    docker network create -d macvlan --subnet= --gateway=  -o parent=eth0 pub_net
     docker run --net=pub_net --ip= -itd centos /bin/sh
  4. Enter the container to view network information

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
     inet  netmask  broadcast
     inet6 fe80::42:c0ff:fea8:282  prefixlen 64  scopeid 0x20<link>
     ether 02:42:c0:a8:02:82  txqueuelen 0  (Ethernet)
     RX packets 0  bytes 0 (0.0 B)
     RX errors 0  dropped 0  overruns 0  frame 0
     TX packets 9  bytes 718 (718.0 B)
     TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    Question: Can’t get online in the container, and is broadcast a problem? My aim is to assign an IP to the container that is on the same network segment as the host computer, and get down on my knees to find the solution. . . …

Docker for Mac/Windows
Sometimes in the development environment, you want to use the Docker container instance as a normal virtual machine. In other words, this machine is located in the same subnet as the Docker container instance. This machine can directly access the Docker container instance through IP address instead of through intermediate port mapping!

Final results:

MacBook, VirtualBox, Docker container instances can freely access each other with IP addresses, just like normal virtual machines.
 You can assign a static IP address to the docker container
 Container instances use a unified DNS server