Не запускается Docker container
Не запускается Docker когда использую entrypoint.sh Выдает ошибку
ERROR: for debt_web_1 Cannot start service web: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "usr/src/app/entrypoint.sh": stat usr/src/app/entrypoint.sh: no such file or directory: unknown ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "usr/src/app/entrypoint.sh": stat usr/src/app/entrypoint.sh: no such file or directory: unknown ERROR: Encountered errors while bringing up the project.
Вот мой dockerfile
FROM python:3.8-alpine
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN python -m pip install --upgrade pip
# install psycopg2 dependencies
RUN apk update \
&& apk add postgresql-dev gcc python3-dev musl-dev
# install dependencies
RUN apk update && apk add g++ gcc libxml2 libxslt-dev
COPY ./req.txt .
RUN pip install -r req.txt
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
# copy project
COPY . .
ENTRYPOINT ["usr/src/app/entrypoint.sh"]
entrypoint.sh
#!/bin/sh
python manage.py makemigrations
sleep 20
python manage.py migrate
gunicorn debt.wsgi:application --bind 0.0.0.0:8000 --reload -w 4
docker-compose.yml
version: '3.7'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./:/usr/src/app/
ports:
- 8000:8000
env_file:
- ./.env.dev
depends_on:
- db
db:
image: postgres:12.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=debt_user
- POSTGRES_PASSWORD=123456
- POSTGRES_DB=debt
volumes:
postgres_data:
Я пробовал добавить RUN chmod +x /usr/src/app/entrypoint.sh
, но это не помогло((
Так же я пробовал через CMD
RUN chmod +x /usr/src/app/entrypoint.sh
CMD ["usr/src/app/entrypoint.sh"]
И docker запускается, но тогда не срабатывают команды внутри
entrypoint.sh