Skip to content

Network modes: bridge, none and host

Select an icon to see what it is.

Step 4 of 6

-p does nothing in host mode

Published ports are NAT rules from a host port to a container address. In host mode there is no separate container address, so there is nothing to translate. docker run prints a warning and discards the -p option.

$ docker run -d --network host -p 8080:80 nginx

CLI output

WARNING: Published ports are discarded when using host network mode