title: Docker container to bring up DB fails with connection refused error
body: <p>Docker : Initialize database doesn't work  </p>
  
  <p>I have a dockerfile that sets up a db. This dockerfile is used in a docker-compose file. </p>
  
  <p>When i run <code>$docker-compose up</code> I get the follwoing error: </p>
  
  <blockquote>
    <p>panic: dial tcp 172.19.0.2:5432: connect: connection refused</p>
  </blockquote>
  
  <pre><code>FROM postgres:9.6 
  ENV POSTGRES_PORT=5432
  ENV POSTGRES_USER=abc
  ENV FLYWAY_VERSION 5.0.2
  RUN apt-get update &amp;&amp; apt-get install -y wget build-essential
  RUN ["mkdir", "/src"]
  RUN wget -q https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/$FLYWAY_VERSION/flyway-commandline-$FLYWAY_VERSION-linux-x64.tar.gz -P /src/
  RUN tar xzf /src/flyway-commandline-$FLYWAY_VERSION-linux-x64.tar.gz -C /src/ RUN chmod +x /src/flyway-$FLYWAY_VERSION/flyway
  ENV PATH=${PATH}:/src/flyway-$FLYWAY_VERSION
  COPY Makefile /src/ COPY migrations /docker-entrypoint-initdb.d/migrations/ COPY flyway.test.conf /docker-entrypoint-initdb.d/
  COPY bin/initdb.sh /docker-entrypoint-initdb.d/
  EXPOSE $POSTGRES_PORT
  </code></pre>