I don’t think you even need to have RUN apt-get install -y python-psycopg2
. You already have RUN apt-get install -y libpq-dev
.
I think you forgot to put psycopg2==2.8.6
inside your requirements.txt
file. Your Dockerfile could change to:
FROM python:3.8-slim
RUN apt-get update && apt-get install
RUN apt-get install -y \
dos2unix \
libpq-dev \
libmariadb-dev-compat \
libmariadb-dev \
gcc \
&& apt-get clean
RUN python -m pip install --upgrade pip
WORKDIR /my-app/
COPY requirements.txt requirements.txt
COPY entrypoint.sh entrypoint.sh
RUN python -m pip install -r requirements.txt
RUN dos2unix /my-app/entrypoint.sh
ENTRYPOINT ["bash", "/my-app/entrypoint.sh"]
And make sure you have this in requirements.txt
psycopg2==2.8.6
Btw, you are using both MariaDB and PostgreSQL in the same project?
CLICK HERE to find out more related problems solutions.