Apologies for newbie question. I've tried all of the answers from other questions here but the don't pay off either.
Dockerizing my python/django app with Postgres is proving... daunting. I'm getting the error "Error: pg_config executable not found." consistently when it starts working through my requirements.txt
Here's the Dockerfile:
FROM python:3.8.3-slim-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD ./ /code/
...and my requirements.txt...
asgiref==3.3.1
Django==3.1.4
psycopg2-binary==2.7.4
pytz==2020.5
sqlparse==0.4.1
django-compressor>=2.2
django-libsass>=0.7
and docker-compose.yml
v ersion: "3.9"
services:
db:
image: postgres
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- pgdata:/var/lib/postgresql/data
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
volumes:
pgdata:
When I run docker-compose up --build I'm getting this error over and over:
Step 6/7 : RUN pip install -r requirements.txt
---> Running in e0fd67d2d935
Collecting asgiref==3.3.1
Downloading asgiref-3.3.1-py3-none-any.whl (19 kB)
Collecting Django==3.1.4
Downloading Django-3.1.4-py3-none-any.whl (7.8 MB)
Collecting psycopg2-binary==2.7.4
Downloading psycopg2-binary-2.7.4.tar.gz (426 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fha1c65p/psycopg2-binary/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fha1c65p/psycopg2-binary/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ewxlxmh6
cwd: /tmp/pip-install-fha1c65p/psycopg2-binary/
Complete output (23 lines):
running egg_info
creating /tmp/pip-pip-egg-info-ewxlxmh6/psycopg2_binary.egg-info
writing /tmp/pip-pip-egg-info-ewxlxmh6/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-ewxlxmh6/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-ewxlxmh6/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-ewxlxmh6/psycopg2_binary.egg-info/SOURCES.txt'
Error: pg_config executable not found.