Setting up Docker Postgres inside Python container

I currently have a python3 web application running in a docker image. I am trying to restore a local database dump in the docker container (dump.pgsql) and connect to that database within my application.
I am having a couple issues.

From within the Python container I can’t seem to download any version of postgres (9.1-9.6) and once I am able to restore the database, how would I get connect (I am currently connecting via Login URI to the cloud database).

  • Unable to find Kubernetes apiserver's data in etcd3
  • Unable to install docker on a fresh debian 8 jessie
  • Keep docker-compose container running after ENTRYPOINT
  • docker daemon doesn't run on vagrant vm(centos/ubuntu)
  • docker: Can't use ls in mount directory
  • Add a potentially large amount of metadata to a docker image
  • My DockerFile is:

    FROM python:3
    ADD . /code
    WORKDIR /code
    EXPOSE 5000
    RUN pip install -r requirements.txt
    #Run Postgres Locally 
    RUN apt-get install -y postgresql-9.2
    RUN postgres restore code.pgsql
    CMD ["python3", "app.py"]
    

    And I run the command with

    docker build -t code .
    docker run --name code -ti -p 8000:8000 code
    

  • Docker Windows bridge ip conflict
  • How do I check if my local docker image is outdated, without pushing from somewhere else?
  • Can't connect to Mongo DB in .Net Core api
  • Equivalent of docker-compose.yml parameters in Docker Cloud
  • Best way to transfer data to named volume of Docker
  • StatusCode.UNAUTHENTICATED when running Vision API demo in Python/Flask running in Docker
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.