java.net.InetAddress java class doesn't resolve IP on Alpine Docker container
问题 When I run this code below inside container Docker running Java JDK 8 on Alpine Linux import java.io.*; import java.util.*; import java.net.*; public class SomaDBTest { public static void main(String... args) throws Throwable { InetAddress ip = InetAddress.getByName("mysql"); System.out.println("Begin - mysql IP Addr = " + ip.getHostAddress()); . . . } } I get the error: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 Exception in thread "main" java.net.UnknownHostException: mysql: unknown