Reputation: 184
I added the codes to below i hope it is clear and precise
Dockerfile:
FROM python:3.8.5-alpine
RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
COPY ./ddc /app
WORKDIR /app
COPY ./entrypoint.sh /
ENTRYPOINT ["sh", "/entrypoint.sh"]
docker-compose.yml
version: '3.7'
services:
django_gunicorn:
volumes:
- static:/static
env_file:
- .env
build:
context: .
ports:
- "8000:8000"
nginx:
build: ./nginx
volumes:
- static:/static
ports:
- "80:80"
depends_on:
- django_gunicorn
volumes:
static:
entrypoint.sh
#!/bin/sh
python manage.py migrate --no-input
python manage.py collectstatic --no-input
gunicorn ddc.wsgi:application --bind 0.0.0.0:8000
First i use docker-compose up --build
and this is what i get:
Building django_gunicorn
Sending build context to Docker daemon 19.46kB
Step 1/8 : FROM python:3.8.5-alpine
---> 0f03316d4a27
Step 2/8 : RUN pip install --upgrade pip
---> Using cache
---> ac5d6a64af93
Step 3/8 : COPY ./requirements.txt .
---> Using cache
---> 8dfb848be8a4
Step 4/8 : RUN pip install -r requirements.txt
---> Using cache
---> 0dee442b9c0a
Step 5/8 : COPY ./ddc /app
---> 21c33e5463d8
Step 6/8 : WORKDIR /app
---> Running in 9153438d9466
Removing intermediate container 9153438d9466
---> d27b60805a1b
Step 7/8 : COPY ./entrypoint.sh /
---> e497fecdfb76
Step 8/8 : ENTRYPOINT ["sh", "/entrypoint.sh"]
---> Running in f6eb59759a71
Removing intermediate container f6eb59759a71
---> 6db361baa8e8
Successfully built 6db361baa8e8
Successfully tagged django-docker-compose_django_gunicorn:latest
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 203, in perform_command
File "compose/metrics/decorator.py", line 18, in wrapper
File "compose/cli/main.py", line 1186, in up
File "compose/cli/main.py", line 1182, in up
File "compose/project.py", line 664, in up
File "compose/service.py", line 348, in ensure_image_exists
File "compose/service.py", line 1133, in build
File "compose/service.py", line 1948, in build
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp5cv0a52z'
[22049] Failed to execute script docker-compose
After that i just use docker-compose up
and the system works as it is expected. What does this error means and how do i avoid it. I use the latest docker and compose which are:
docker:Docker version 19.03.13, build cd8016b6bc
docker-compose version 1.29.2, build 5becea4c
Upvotes: 1
Views: 2183
Reputation: 184
The issue is resolved after i change my installation from ubuntu snap to
https://docs.docker.com/engine/install/ubuntu/
https://docs.docker.com/compose/install/
Upvotes: 1