I deployed a custom set of services via a home-brew Catalog. I wanted to use the rancher metadata service to get information about the service and stack, however, I notice they’re missing. The only thing available is “host”. From within a container I can view this by using curl:
Yes, metadata is based on the source-ip of the request… with host networking the source is the host, and there is no way to differentiate which container “self” is.
Thank you @vincent. Sorry for the question, but is there any way for me to start a container and bind it to the HOST IP when I’m not running in host mode? I would like the self metadata, but I also have a bunch of ports to expose, and they need to be bound to the host IP and not the internal one.
If you actually need net:host then no, but you can get info about the container (or service, etc) by name from the rest of metadata.
Managed network + normal port mapping makes ports available on the host’s public IP address(es), so you may be misunderstanding what net:host is for and not actually need it?
@vincent, it’s really only for one port - 53 (TCP/UDP). I am running a DNS server in one of my containers and I need port 53 to be exposed back to the machines. I tried to run the DNS servers on port 54 in my container, and then use a load balancer to setup a rule to forward 53 to 54, but the load balancer doesn’t support UDP. Any other ideas on how I could do this while running n the managed network? I’ve got port 53 mapped in my docker-compose.yml - both UDP and TCP.