Skip to content

Host networking

Host networking, or --net host, allows containers to inherit the host's network namespace instead of being an independent host on a bridge network. Unlike other Docker providers for macOS, OrbStack supports host networking out of the box.

Local ports

Any servers you run in the container will be accessible from Mac on localhost. The reverse is also true: any servers running on Mac will be accessible from the container on localhost. This removes the need to use host.docker.internal or configure port forwards.

Host networking is different from port forwards: whereas port forwards need to be set up for each individual port, host networking makes the entire port range (1–65535) available. This is useful for services that generate ports dynamically.

You should also consider using OrbStack domains instead of localhost to get the entire port range while having a nice domain name to work with, and avoiding conflicts between containers.


To run a container with host networking, simply add --net host to your docker run command:

docker run --rm --net host nginx
docker run --rm --net host nginx

Multiple containers

Since host networking shares the host's network namespace, localhost ports, IP addresses, and other network resources are shared between all containers that use host networking.