I'm having a problem with starting my django project in docker container. I have tried this in multiple ways, for example:
docker-compose run web python manage.py runserver
or just
docker-compose up
first time i have tried this i got no error, but i couldn't open the app in browser so i tried it again and then it stopped working completely. I'm getting this error:
manage.py runserver: error: unrecognized arguments: python manage.py runserver
My docker-compose.yml
version: "3.9"
services:
db:
image: postgres:alpine
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=gitlabdumptables
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
environment:
- POSTGRES_NAME=gitlabdumptables
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
depends_on:
- db
My Dockerfile
# syntax=docker/dockerfile:1
FROM python:3
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip3 install -r requirements.txt
CMD python manage.py makemigrations
CMD python manage.py migrate
COPY . /code/
ENTRYPOINT [ "python", "manage.py", "runserver", "0.0.0.0:8000" ]