when i tryna run a django server with docker-compose up, i got this error
[+] Running 2/2
✔ Network service_default Created 0.3s
✔ Container service-web-app-1 Created 0.5s
Attaching to service-web-app-1
service-web-app-1 | python3: can't open file 'manage.py': [Errno 2] No such file or directory
service-web-app-1 exited with code 2
My docker-compose
version: "3.9"
services:
# postgres:
# image: postgres:15
# container_name: dj_post
# env_file:
# - .env
web-app:
build:
dockerfile: ./Dockerfile
context: .
ports:
- '8000:8000'
command: >
sh -c "python3 manage.py runserver "
My Dockerfile
FROM python:3.8-alpine3.16
COPY requirements.txt /temp/requirements.txt
WORKDIR /service
EXPOSE 8000
RUN pip install -r /temp/requirements.txt
RUN adduser --disabled-password service-user
USER service-user
I will attach the architecture of the folders below, but I immediately say that by setting the full path to manage.py in docker-compose file I get the same error,I just started studying docker and for two days I can’t find a working solution to this problem,share your ideas:(
1
You need copy all files to the service folder
WORKDIR /service
COPY . .