title: getting java.net.UnknownHostException while running GOCD docker container in QNAP
body: <p>I am trying to run gocd docker container (<a href="https://hub.docker.com/r/gocd/gocd-server/" rel="nofollow">https://hub.docker.com/r/gocd/gocd-server/</a>) on QNAP (TS-451 x86 based, firmware 4.2.0) in container station.</p>
  
  <p>container doesn't' start and bombs out with java.net.UnknownHostException:</p>
  
  <pre><code>May 21 20:21:28 gocd-server-1 syslog-ng[16]: syslog-ng starting up; version='3.5.3'                                                                              
  using default settings from /etc/default/go-server                                                                                                               
  ERROR: Failed to start Go server. Please check the logs.                                                                                                         
  java.lang.RuntimeException: gocd-server-1: gocd-server-1                                                                                                         
          at com.thoughtworks.go.util.ExceptionUtils.bomb(ExceptionUtils.java:36)                                                                                  
          at com.thoughtworks.go.server.util.GoSslSocketConnector.getHostname(GoSslSocketConnector.java:102)                                                       
          at com.thoughtworks.go.server.util.GoSslSocketConnector.storeX509Certificate(GoSslSocketConnector.java:92)                                               
          at com.thoughtworks.go.server.util.GoSslSocketConnector.sslConnector(GoSslSocketConnector.java:56)                                                       
          at com.thoughtworks.go.server.util.GoSslSocketConnector.&lt;init&gt;(GoSslSocketConnector.java:51)                                                             
          at com.thoughtworks.go.server.Jetty9Server.sslConnector(Jetty9Server.java:133)                                                                           
          at com.thoughtworks.go.server.Jetty9Server.configure(Jetty9Server.java:76)                                                                               
          at com.thoughtworks.go.server.GoServer.configureServer(GoServer.java:84)                                                                                 
          at com.thoughtworks.go.server.GoServer.startServer(GoServer.java:70)                                                                                     
          at com.thoughtworks.go.server.GoServer.go(GoServer.java:63)                                                                                              
          at com.thoughtworks.go.server.util.GoLauncher.main(GoLauncher.java:31)                                                                                   
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                           
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)                                                                         
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                 
          at java.lang.reflect.Method.invoke(Method.java:606)                                                                                                      
          at com.simontuffs.onejar.Boot.run(Boot.java:306)                                                                                                         
          at com.simontuffs.onejar.Boot.main(Boot.java:159)                                                                                                        
  Caused by: java.net.UnknownHostException: gocd-server-1: gocd-server-1                                                                                           
          at java.net.InetAddress.getLocalHost(InetAddress.java:1496)                                                                                              
          at com.thoughtworks.go.server.util.GoSslSocketConnector.getHostname(GoSslSocketConnector.java:100)                                                       
          ... 15 more                                                                                                                                              
  Caused by: java.net.UnknownHostException: gocd-server-1                                                                                                          
          at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) 
  </code></pre>
  
  <p>I checked /etc/hosts inside the container - it includes correct host mapping : 10.0.3.2 gocd-server-1</p>
  
  <pre><code>127.0.0.1       localhost
  ::1     localhost ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  10.0.3.2 gocd-server-1
  
  hostname resovles correctly:
  root@gocd-server-1:/tmp# hostname
  gocd-server-1
  </code></pre>
  
  <p>the container image is fine - I have run exactly the same gocd docker container on vagrant Ubuntu vm without any issues</p>
  
  <p>so the issue is somehow related to QNAP Linux (which seems to be Ubuntu 4.1.2)</p>
  
  <p>[~] # cat /proc/version
  Linux version 3.12.6 (root@NasX86-12) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1 SMP Fri Mar 11 02:20:16 CST 2016)</p>
  
  <p>any ideas how to get around java.net.UnknownHostException exception?</p>