title: Unable to set localhost. This prevents creation of a GUID
body: <p>I'm struggling with the following issue. We have a Java application that is running properly on Docker. Now, when we try to migrate the application to Docker Swarm--running it as a service--it always throws the following exception:</p>
  
  <pre><code> Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: 39bc5cdfb3d9: 39bc5cdfb3d9: Name or service not known
  java.net.UnknownHostException: 39bc5cdfb3d9: 39bc5cdfb3d9: Name or service not known
  </code></pre>
  
  <p>Note that <code>39bc5cdfb3d9</code> is the container ID.</p>
  
  <p>I've tried the following:</p>
  
  <ol>
  <li><code>curl</code> against the DNS that we are using</li>
  <li>updating the <code>nginx</code> config that the other server is back up</li>
  </ol>
  
  <p>Setup:</p>
  
  <ol>
  <li>3 Mangers </li>
  <li>containers runs only on the 2 servers app1.dev and app2.dev it has a constraint label=dev</li>
  <li>using the default network ingress,</li>
  </ol>
  
  <p>DNS:dev-ecc.toroserver.com
  I run the service using this:</p>
  
  <pre><code>     docker service create \
              ${HTTP} \
              ${HTTPS} \
              ${VOLUMES} \
              ${ENV_VARS} \
              ${LICENSE} \
              ${LOGS} \
              --limit-memory 768mb \
              --mode=global \
              --constraint 'engine.labels.serverType == dev' \
              --env appName="${SUB_DNS}" \
              --name="${SUB_DNS}" \
              --restart-condition on-failure --restart-max-attempts 5 \
              --with-registry-auth \
              ${DOCKER_REGISTRY}/${DOCKER_USER}/${APPNAME}:${VERSION}
  </code></pre>
  
  <p>Also I've got this error every time I tried to login, it will automatically logout my session , Not sure if it is related to the error Unable to set localhost</p>
  
  <pre><code>2017-11-08 03:25:56,771 [ INFO] AjaxTimeoutRedirectFilter - User session expired or not logged in yet
  2017-11-08 03:25:56,771 [ INFO] AjaxTimeoutRedirectFilter - User session expired or not logged in yet
  2017-11-08 03:25:56,778 [ INFO] AjaxTimeoutRedirectFilter - Redirect to login page
  2017-11-08 03:25:56,778 [ INFO] AjaxTimeoutRedirectFilter - Redirect to login page
  2017-11-08 03:30:36,822 [ INFO] AjaxTimeoutRedirectFilter - User session expired or not logged in yet
  2017-11-08 03:30:36,822 [ INFO] AjaxTimeoutRedirectFilter - User session expired or not logged in yet
  </code></pre>
  
  <p>Any insights will be much appreciated. Thanks.</p>