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).
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