I am a newbie using Docker, I have completed my web application in Django, and I want to containerize it using Docker. I have gone through a particular tutorial where an existing web application was dockerized successfully but when I tried the same method, I got an error which says Failed to execute script docker-compose
error logs
Building web
Traceback (most recent call last):
File "compose\cli\main.py", line 67, in main
File "compose\cli\main.py", line 126, in perform_command
File "compose\cli\main.py", line 302, in build
File "compose\project.py", line 468, in build
File "compose\project.py", line 450, in build_service
File "compose\service.py", line 1147, in build
compose.service.BuildError: (<Service: web>, {'message': 'dockerfile parse error line 1: FROM requires either one or three arguments'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 78, in main
TypeError: can only concatenate str (not "dict") to str
[11920] Failed to execute script docker-compose
Dockerfile
FROM python: 3
ENV: PYTHONUNBUFFERED 1
WORKDIR /app
ADD . /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app
docker-compose.yml
version: '3'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
ports:
- 8000:8000
I was able to solve the issu by removing the second line of the code and restructuring my code to look like this:
Dockefile