title: Multiple databases in docker and docker-compose
body: <p>I have a project consisting of two main Java apps that use eight Postgres databases, so is there a way in docker-compose to build eight different databases so that each one has a different owner and password? Can I even do that in docker-compose?</p>
  <p>Example:</p>
  <pre class="lang-yml prettyprint-override"><code>services:
      postgresql:
          build: db/.
          ports:
              - &quot;5432:5432&quot;
          environment:
            - POSTGRES_DB=database1
            - POSTGRES_USER=database1
            - POSTGRES_PASSWORD=database1
  </code></pre>
  <p>I know I can put all the .sql files in the docker-entrypoint-initdb.d and Postgres will make them automatically, but how do I declare what .sql file goes in what database?</p>