title: Container hostname is not resolved to IP
body: <p>I am trying to set the host for connection to Neo4j in the application.conf file using environment variable which is going to be set in a Dockerfile. Neo4j is used as an image from the docker-compose.yml file. 
  When I run an image of the application with the hostname of the Neo4j container I get an error <code>ServiceUnavailableException: Unable to connect to neo4jdb:7687, ensure the database is running and that there is a working network connection to it</code></p>
  
  <p>So the name of the container is not resolved to the IP-address. How can I fix it?</p>
  
  <p>Configurations file:</p>
  
  <pre><code>neo4j{
      url= "bolt://localhost:7687"
      url= ${?HOSTNAME}
      user = "user"
      password = "password"
  }
  </code></pre>
  
  <p>Application Dockerfile:</p>
  
  <pre><code>FROM java:8
  ARG ARG_CLASS
  ENV MAIN_CLASS $ARG_CLASS
  ENV SCALA_VERSION 2.11.8
  ENV SBT_VERSION 1.1.1
  ENV SPARK_VERSION 2.2.0
  ENV SPARK_DIST spark-$SPARK_VERSION-bin-hadoop2.6
  ENV SPARK_ARCH $SPARK_DIST.tgz
  ENV HOSTNAME bolt://neo4jdb:7687
  VOLUME /workdir
  
  WORKDIR /opt
  
  # Install Scala
  RUN \
    cd /root &amp;&amp; \
    curl -o scala-$SCALA_VERSION.tgz http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz &amp;&amp; \
    tar -xf scala-$SCALA_VERSION.tgz &amp;&amp; \
    rm scala-$SCALA_VERSION.tgz &amp;&amp; \
    echo &gt;&gt; /root/.bashrc &amp;&amp; \
    echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' &gt;&gt; /root/.bashrc
  
  # Install SBT
  RUN \
    curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb &amp;&amp; \
    dpkg -i sbt-$SBT_VERSION.deb &amp;&amp; \
    rm sbt-$SBT_VERSION.deb
  
  
  # Install Spark
  RUN \
      cd /opt &amp;&amp; \
      curl -o $SPARK_ARCH http://d3kbcqa49mib13.cloudfront.net/$SPARK_ARCH &amp;&amp; \
      tar xvfz $SPARK_ARCH &amp;&amp; \
      rm $SPARK_ARCH &amp;&amp; \
      echo 'export PATH=$SPARK_DIST/bin:$PATH' &gt;&gt; /root/.bashrc
  
  
  EXPOSE 9851 9852 4040 9092 9200 9300 5601 7474 7687 7473
  
  CMD /workdir/runDemo.sh "$MAIN_CLASS"
  </code></pre>
  
  <p>I build and run my application separately with this commands:</p>
  
  <pre><code>docker build -t container-name --build-arg ARG_CLASS=producer .
  docker run -v ${PWD}/:/workdir -w /workdir container-name
  </code></pre>
  
  <p>Docker-compose file looks like this:</p>
  
  <pre><code>version: '3.3'
  services:
    kafka:
      image: spotify/kafka
      ports:
       - "9092:9092"
      networks:
        - docker_elk
      environment:
      - ADVERTISED_HOST=localhost
    neo4jdb:
      image: neo4j:latest
      ports:
        - "7474:7474"
        - "7473:7473"
        - "7687:7687"
      networks:
        - docker_elk
      volumes:
        - /var/lib/neo4j/import:/var/lib/neo4j/import
        - /var/lib/neo4j/data:/data
        - /var/lib/neo4j/conf:/conf
      environment:
        - NEO4J_dbms_active__database=graphImport.db
    elasticsearch:
      image: elasticsearch:latest
      ports:
        - "9200:9200"
        - "9300:9300"
      networks:
        - docker_elk
      volumes:
          - esdata1:/usr/share/elasticsearch/data
    kibana:
      image: kibana:latest
      ports:
        - "5601:5601"
      networks:
        - docker_elk
  volumes:
    esdata1:
      driver: local
  
  networks:
    docker_elk:
      driver: bridge
  </code></pre>