Answer the question
In order to leave comments, you need to log in
Where is the error in docker-compose file?
Good day!
I want to build a django application with postgresql.
dockerfile example
FROM python:3.6
ENV PYTHONUNBUFFERED 1
COPY ./requirements /requirements/
RUN pip install -r /requirements/local.txt
RUN apt-get update && apt-get upgrade
RUN apt-get install -y \
postgresql-server-dev-all \
postgresql-client
WORKDIR /app
EXPOSE 8080
version: "2"
services:
db:
image: postgres
expose:
- "5432"
web:
restart: always
image: test-project-django
env_file: ./config/.env
command: ./manage.py runserver 0.0.0.0:8080
ports:
- "8080:8080"
volumes:
- .:/app
links:
- db
DJANGO_DEBUG=True
DJANGO_SECRET_KEY="secret"
DJANGO_DATABASE_URL=postgres:///docker_django
django.db.utils.OperationalError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Answer the question
In order to leave comments, you need to log in
Likbez:
Regarding your problem: you have django configured to connect locally to a database that is not running (and it is not clear why it is in the image at all), while it should be configured to connect to another container.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question