java.net.UnknownHostException with Alpine Linux

There is no Name Service Switch file in Alpine linux, and java need one for java.net.InetAddress.getLocalHost for example.

echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' > /etc/nsswitch.conf

Or in a Dockerfile :

RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' > /etc/nsswitch.conf

Comments

comments powered by Disqus