Which IP will Rancher choose when 'Host' network used

When we fire up a new service within a stack, we can choose our container to use host networking, and in the port map we can also mention we want a container port of 1234 but we want Rancher to choose the “Public Host [IP:]Port” by setting it blank.

If we do this and start the service, which IP will rancher choose on the host to use?

Rancher can’t control or manage networking for a container using host mode networking.

If you start a container in this mode whatever process/application/service you’re running inside it needs to be configured in an appropriate way to listen on one of the host’s IPs of your choosing or, if you don’t want to do that, all IPs.

This is in no way different to how you’d need to do perform that configuration if you were running on bare metal.

To put it another way, the configuration for running Apache on a bare metal server running CentOS or in a container with host mode networking is exactly the same where any network elements of the Apache configuration are concerned (specifically the Listen directive).

Aha, makes sense! Thanks for the clear reply.

1 Like