I found a Django project and failed to get it running in Docker container in the following way:
git clone https://github.com/hotdogee/django-blast.git
I have the following Dockerfile:
FROM python:2
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
For docker-compose.yml
I use:
version: "3"
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
Next, I ran into this error:
$ docker-compose build
...
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Gq_JSR/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Gq_JSR/psycopg2/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-install-Gq_JSR/psycopg2/pip-egg-info
cwd: /tmp/pip-install-Gq_JSR/psycopg2/
Complete output (7 lines):
running egg_info
creating /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file '/tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: could not determine PostgreSQL version from '11.7'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
What did I miss?
Thank you in advance