When using Docker, be aware of the differences between platforms, such as the Docker for Mac implementation and the standard Docker specification, Docker for Mac Daemon is running in virtual machines (XHYVE), Instead of running on a host as a process like Linux, the Docker for Mac does not have a DOCKER0 bridge and cannot implement the host network mode, which causes container to reuse the daemon network stack (in Xhyve virtual machines). Instead of the host hosts network stack, so that while other containers can still interact through the XHYVE network stack, it is not a port on the host (inaccessible on host). Bridge network mode-p parameter is not affected by this, it can open the port on host normally and map to the corresponding port of container. The documentation is not fully documented at this point, and it is easy to step on the pits.
Reference:
Docker Network mode
Hxyve Introduction
Docker for Mac does not have a DOCKER0 bridge