On my work there is a docker project with all backend setup. The code of dockerfile:
FROM python:3.9.6-alpine
# Установка локальных переменных
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /usr/src/freedom
WORKDIR /usr/src/freedom
# Установка зависимостей для Django
RUN apk update \
&& apk add postgresql \
&& apk add postgresql-dev \
&& apk add gcc libc-dev make git libffi-dev openssl-dev python3-dev libxml2-dev libxslt-dev \
&& apk add jpeg-dev zlib-dev libjpeg libffi-dev
# && pip install Pillow \
# && apk del build-deps
# ENV LANG C.UTF-8
# ENV LC_ALL C.UTF-8
CMD python3 --version
CMD . env/bin/activate
COPY ./requirements.txt ./requirements.txt
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY . .
# run entrypoint.sh
ENTRYPOINT ["/usr/src/freedom/entrypoint.sh"]
When running the project with docker-compose up --build
(right after clonning, no shenanigans) on Linux everything works fine. It finds its entrypoint.sh fine) its okay. When running from windows entrypoint dont run.
Please help
I tried:
docker-compose up --build
? Like, if you use ls
in the same place you execute that command, does it have the entrypoint.sh
file? RUN ls -la
between the COPY
and ENTRYPOINT
instructions? One option you have is to call the shell and execute the file, as if: ENTRYPOINT["/bin/sh", "-c", "sh /usr/src/freedom/entrypoint.sh"]
But in the end I think the best solution will be to simply use a single CMD
instruction, like: CMD["/usr/src/freedom/entrypoint.sh"]
(with this I mean you should remove all the CMD
and ENTRYPOINT
instructions you currently have and use this one.)
You can check the difference between CMD
and ENTRYPOINT
in the documentation and this SoF post:
Also, as stated in the documentation, having two CMD commands is useless since the latest one is the one that will be applied.