title: Create a postgres database in my Dockerfile
body: <p>in my project i have a docker-compose.yml file like this:</p>
  
  <pre><code>version: '3'
  
  networks:
    mynetwork:
      driver: bridge
  
  services:
  
    postgres:
      restart: always
      image: postgres:11
      ports:
        - "5432:5432"
      healthcheck:
          test: ["CMD", "curl", "-f", "http://localhost:5432"]
          interval: 30s
          timeout: 10s
          retries: 5
      volumes:
        - ./data:/var/lib/postgresql/data
  
    web:
      build: .
      image: &lt;myrepo&gt;/&lt;mypath&gt;
      command: python /Code/core/manage.py runserver 0.0.0.0:8000
      networks:
        - mynetwork
  
      ports:
        - "8000:8000"
  
      depends_on:
        - postgres
  </code></pre>
  
  <p>Now i would to build my dockerized app as an image using only Dockerfile instead docker compose.
  I need a way for create a postgres db image using my docker file like i did with docker-compose.</p>
  
  <p>My actual dockerfile is:</p>
  
  <pre><code>FROM python:3.6-alpine
  RUN apk add --no-cache make linux-headers libffi-dev jpeg-dev zlib-dev
  RUN apk update &amp;&amp; apk add postgresql-dev gcc python3-dev musl-dev
  #RUN apk update &amp;&amp; apk add build-essential libssl-dev libffi-dev
  RUN mkdir /Code
  WORKDIR /Code
  COPY ./requirements.txt .
  
  RUN pip install --upgrade pip
  RUN pip install -r requirements.txt
  ENV PYTHONUNBUFFERED 1
  
  COPY . /Code/
  
  ENTRYPOINT python /Code/core/manage.py runserver 0.0.0.0:8000
  </code></pre>
  
  <p>How can i create and start a postgres db container from Dockerfile?</p>
  
  <p>So many thanks in advance</p>