I need to create a container image for python. I have created a Dockerfile and docker-compose.yml. I build the image, but the wrong directory is set for the project. I see the following error:
web_1 | python: can't open file 'manage.py': [Errno 2] No such file or directory
Structure of the project:
folder_project
|
|-django.testsite: manage.py and other files
|-python: Docerfile
|-docer-compose.yml
docker-compose.yml
version: '3'
services:
web:
build: ./python
ports:
- "5000:5000"
redis:
image: "redis:alpine"
Dockerfile
FROM python:3
RUN easy_install pip
RUN pip install django==1.9.12
ADD . /django.testsite
WORKDIR /django.testsite
CMD ["python", "manage.py", "runserver"]
Wrong context path. Use:
build:
context: .
dockerfile: python/Dockerfile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.