title: postgresql: dockerfile create user and database from entrypoint script
body: <p>I have a Dockerfile</p>
  
  <pre><code>COPY ./docker-entrypoint.sh /
  
  RUN chmod +x /docker-entrypoint.sh
  
  USER postgres
  
  ENTRYPOINT ["/docker-entrypoint.sh"]
  </code></pre>
  
  <p>where docker-entrypoint.sh is:</p>
  
  <pre><code>#!/bin/sh
  
  # Before PostgreSQL can function correctly, the database cluster must be initialized:
  initdb -D /var/lib/postgres/data
  
  
  #start postgres server
  /usr/bin/postgres -D /var/lib/postgres/data &amp;
  
  
  # create a user or role
  psql -d postgres -c "CREATE USER someuser WITH PASSWORD 'jkhkjah';" 
  
  # create database 
  
  psql -d postgres -c "CREATE DATABASE dockertest OWNER 'someuser';"
  </code></pre>
  
  <p>It does not create someuser and dockertest database. how to do this</p>