Mac Docker Limitation

For MacOS since it's not native linux base, we cannot access docker based on their internal IP address.

The docker linux bridget network is not reachable from macOS host.

For example if you have something like this:

services:
  server1:
    build: .
    container_name: server1
    networks:
      server_net:
        ipv4_address: 172.20.0.2

  server2:
    build: .
    container_name: server2
    networks:
      server_net:
        ipv4_address: 172.20.0.3

  server3:
    build: .
    container_name: server3
    networks:
      server_net:
        ipv4_address: 172.20.0.4

networks:
  server_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.20.0.0/16

You won't be able to access interface 172.20.0.0/16. In fact, in your ifconfig this interface would not even show.

However on linux this interface will show.