title: Can't connect to a testcontainer Postgres instance
body: <p>I've created a Postgres instance using testcontainers. The container starts but I cannot access it.</p>
  
  <p>I have tried connecting at the containerized DB using DBeaver.
  In the eclipse console everything seems fine: </p>
  
  <blockquote>
    <p>01:29:34.662 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: com.github.dockerjava.core.command.CreateContainerCmdImpl@73386d72[name=,hostName=,domainName=,user=,attachStdin=,attachStdout=,attachStderr=,portSpecs=,tty=,stdinOpen=,stdInOnce=,env=<b>{POSTGRES_USER=test,POSTGRES_PASSWORD=test,POSTGRES_DB=ASIGDB_TEST}</b></p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>public class CustomPostgresContainer extends PostgreSQLContainer&lt;CustomPostgresContainer&gt;{
      private static final String IMAGE_VERSION = "postgres:9.6";
      private static CustomPostgresContainer customPostgresContainer;
      private static final int EXPOSED_PORT = 5555;
      private static final String DB_NAME = "ASIGDB_TEST";
      private static final String DB_USER= "test";
      private static final String DB_PASSWORD= "test";
  
  
      public CustomPostgresContainer() {
          super(IMAGE_VERSION);
      }
  
      public static CustomPostgresContainer getCustomPostgresContainerInstance() {
          if(customPostgresContainer == null) {
              return extracted().withExposedPorts(EXPOSED_PORT)
                                                  .withDatabaseName(DB_NAME)
                                                  .withUsername(DB_USER)
                                                  .withPassword(DB_PASSWORD);
          }
  
          return customPostgresContainer;
      }
  
      private static CustomPostgresContainer extracted() {
          return new CustomPostgresContainer();
      }
  
      @Override
      public void start() {
          super.start();
      }
  
      @Override
      public void stop() {
          //do nothing, JVM handles shut down
      }
  }
  </code></pre>
  
  <p>I get:</p>
  
  <blockquote>
    <p>Connection to localhost:5555 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.</p>
  </blockquote>
  
  <p>Does anyone know what is going on?</p>