title: Docker-Compose Postgresql import dump
body: <p>I have a question about docker and postgres. I am setting up a new postgres database every time docker is starting up and want to import a given dump.</p>
  
  <p>My Problem is like, but the answers are not sufficient for me: <a href="https://stackoverflow.com/questions/34691412/docker-postgres-does-not-run-init-file-in-docker-entrypoint-initdb-d">Docker postgres does not run init file in docker-entrypoint-initdb.d</a></p>
  
  <p>Docker-Compose:</p>
  
  <pre><code>postgres:
    environment:
     - POSTGRES_USER=****
     - POSTGRES_PASSWORD=****
     - POSTGRES_DB=****
  build:
    context: .
    dockerfile: dockerfile-postgres
  </code></pre>
  
  <p>My Dockerfile: (I tried it already with a script with .sh ending)</p>
  
  <pre><code>FROM postgres
  ADD dump.sql /docker-entrypoint-initdb.d/
  </code></pre>
  
  <p>According to <a href="https://hub.docker.com/_/postgres/" rel="noreferrer">https://hub.docker.com/_/postgres/</a> dump.sql must be used to import the database.</p>
  
  <p>Starting up the application with docker only gives:</p>
  
  <pre><code>postgres_1     | LOG:  invalid record length at 0/1708600
  postgres_1     | LOG:  redo is not required
  postgres_1     | LOG:  MultiXact member wraparound protections are now enabled
  postgres_1     | LOG:  database system is ready to accept connections
  postgres_1     | LOG:  autovacuum launcher started
  </code></pre>
  
  <p>Besides I tested if my database has been imported, there is no table in my database. What am I doing wrong (files are read- and executable on target system)? Importing it with psql is no problem, so my dump is correct.</p>
  
  <p>I hope you can help me and I want to thank you in advance for it.</p>