Container hostname rmi

Hi,
I have a small challenge using a RMI service over rancher.

I have a remote JCS cache. It seems that JCS will lookup it’s own hostname and return the IP registered.
Right now it will return a 172.17.0.x address.

Is there a way of forcing the local hostname of container to be resolved as the container IP?

I hope I made myself clear :smile:

–EDIT
After a complete removal of service (including images) and a new deployement, the container suddenly started listening on the correct port.
I do not know why. Maybe a glitch in the DNS service.
I’ll see if I can reproduce this issue after some more testing.

br hw

Hi,
it turned out I’m facing the same issue again.

So, is it possible to get hostname of container to resolve to the container ip?

br hw

Not sure if this helps but this is what we do to get the Rancher IP (as opposed to the Docker IP) for the container.

EUREKA_INSTANCE_HOSTNAME=$(curl http://rancher-metadata/latest/self/container/primary_ip)

We pass this as a parameter to Eureka, not sure if you can do that with JCS

Hi,
yes, I think I need to something similar.

I belive jcs is using inetaddress.getlocalhost and this might return wrong IP.

Br hw

I answer my own question yet again :slightly_smiling:

I needed to set -Djava.rmi.server.hostname= -Djava.rmi.server.useLocalHostname=true

This will force rmi server to use correct managed ip for service.

br hw