I'm using Docker v 19. I have this at the end of my web/Dockerfile ...
FROM python:3.7-slim
RUN apt-get update && apt-get install
RUN apt-get install -y dos2unix
RUN apt-get install -y libmariadb-dev-compat libmariadb-dev
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc \
&& rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
WORKDIR /app/
COPY requirements.txt requirements.txt
COPY entrypoint.sh entrypoint.sh
RUN tr -d '\r' < entrypoint.sh > /app/entrypoint2.sh
RUN ls /app/entrypoint2.sh
RUN ls /app/
RUN python -m pip install -r requirements.txt
RUN ls /app/entrypoint.sh
RUN dos2unix /app/entrypoint.sh
RUN ls /app/entrypoint.sh
RUN chmod +x /app/*.sh
RUN ls ./
ENTRYPOINT ["./entrypoint2.sh"]
However, when I run "docker-compose up" (which references the above), the "entrypoiet" file can't be found, which is baffling because the line above ("ls ./") shows that it exists ...
Step 14/19 : RUN ls /app/entrypoint.sh
---> Running in db8c11ce3fad
/app/entrypoint.sh
Removing intermediate container db8c11ce3fad
---> c23e69de2a86
Step 15/19 : RUN dos2unix /app/entrypoint.sh
---> Running in 9e5bbd1c0b9a
dos2unix: converting file /app/entrypoint.sh to Unix format...
Removing intermediate container 9e5bbd1c0b9a
---> 32a069690845
Step 16/19 : RUN ls /app/entrypoint.sh
---> Running in 8a53e70f219b
/app/entrypoint.sh
Removing intermediate container 8a53e70f219b
---> 5444676f45fb
Step 17/19 : RUN chmod +x /app/*.sh
---> Running in 5a6b295217c8
Removing intermediate container 5a6b295217c8
---> 8b5bfa4fd75a
Step 18/19 : RUN ls ./
---> Running in 9df3acb7deb7
entrypoint.sh
entrypoint2.sh
requirements.txt
Removing intermediate container 9df3acb7deb7
---> 009f8bbe18c8
Step 19/19 : ENTRYPOINT ["./entrypoint2.sh"]
---> Running in 41a7e28641a7
Removing intermediate container 41a7e28641a7
---> 34a7d4fceb8b
Successfully built 34a7d4fceb8b
Successfully tagged maps_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
...
Creating maps_web_1 ... error
ERROR: for maps_web_1 Cannot start service web: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"./entrypoint2.sh\": stat ./entrypoint2.sh: no such file or directory": unknown
How do I tell Docker how to reference that entrypoint file? The docker-compose.yml file section including the above is below
web:
restart: always
build: ./web
ports: # to access the container from outside
- "8000:8000"
env_file: .env
environment:
DEBUG: 'true'
command: /usr/local/bin/gunicorn directory.wsgi:application --reload -w 2 -b :8000
volumes:
- ./web/:/app
depends_on:
- mysql
Based on the provided Dockerfile and docker-compose file you are doing the following
/app
/app
, which is causing the issue.To solve the issue you have to do one of the following
./web
to the docker image and remove the volumeDockerfile : add the following lines
Docker-compose: remove the below lines
Dockerfile