For containers in "HOST" mode, Docker does not allow a container port to be mapped to a host port different from the container one. So if a container needs to publish port 8080, its host port must be set to 8080 regardless what value is assigned to the container_port field. The container should be set to "BRIDGE" or "CONTAINER" mode if there are container ports to be mapped to ephemeral host ports.
For containers in "HOST" mode, Docker does not allow a container port to be mapped to a host port different from the container one. So if a container needs to publish port
8080
, its host port must be set to8080
regardless what value is assigned to thecontainer_port
field. The container should be set to "BRIDGE" or "CONTAINER" mode if there are container ports to be mapped to ephemeral host ports.