In my docker container (Java application), the call to InetAddress.getLocalHost().getHostName() returns the same name we gave in docker run --name 'myserver'.
Is there a way to let InetAddress.getLocalHost().getHostName() return "localhost" in Java code inside the docker container?
My /etc/hosts in the docker container looks like this:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
<snip>
172.17.0.5 myserver