我的docker-compose
工作正常,运行在Windows 10
上,但当我试图从ubuntu 20.04
运行它时,我得到这个错误:
ERROR: for container_web_1 Cannot start service web: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/usr/src/app/entrypoint.sh": permission denied: unknown
ERROR: for web Cannot start service web: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/usr/src/app/entrypoint.sh": permission denied: unknown
ERROR: Encountered errors while bringing up the project.
我不明白为什么我得到Permission denied
的entrypoint.sh
?我用chmod +x
来避免这个...
我的Dockerfile
FROM python:3.10.0-alpine
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pip
RUN apk update
RUN apk add postgresql-dev gcc python3-dev musl-dev
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY entrypoint.sh .
RUN sed -i 's/\r$//g' /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
COPY .. .
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
RUN mkdir $HOME
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
COPY .. $APP_HOME
RUN mkdir $APP_HOME/staticfiles
RUN mkdir $APP_HOME/mediafiles
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
1条答案
按热度按时间0g0grzrc1#
您的Dockerfile有问题。在您创建
entrypoint.sh
并执行chmod +x
之后,您会使用COPY .. .
覆盖权限。解决此问题的一种方法是将RUN chmod +x /usr/src/app/entrypoint.sh
行放在最后,正好在ENTRYPOINT
之前。