linux Windows 10 Docker -未找到入口点

3phpmpom  于 2023-01-25  发布在  Linux
关注(0)|答案(2)|浏览(142)

在我的工作中有一个所有后端设置的Docker项目。

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"]

当在Linux上用docker-compose up --build运行项目时(克隆后立即运行,没有恶作剧),一切都很好。它找到了它的www.example.com。没关系。当从Windows入口点运行时,不要运行。entrypoint.sh fine) its okay. When running from windows entrypoint dont run.

  • 从全局路径(如"C:/abc/abc/..")运行入口点

请帮帮忙
我试过:

  • 删除ENTRYPOINT并将其作为CMD运行
  • 在我的C:上添加/usr/src/freedom的入口点文件夹
  • 改变路径
oymdgrw7

oymdgrw71#

您可以选择调用shell并执行文件,就像:ENTRYPOINT ["/bin/sh", "-c", "sh /usr/src/freedom/entrypoint.sh"]
但最终我认为最好的解决方案是简单地使用单个CMD指令,例如:CMD ["/usr/src/freedom/entrypoint.sh"](我的意思是,您应该删除当前拥有的所有CMDENTRYPOINT指令,并使用此指令。)
您可以在文档和此SoF帖子中查看CMDENTRYPOINT之间的差异:

此外,如文档中所述,有两个CMD命令是无用的,因为最新的命令是将要应用的命令。

oyjwcjzk

oyjwcjzk2#

使用Docker时,Windows 10中的错误“找不到入口点”通常表示在容器中找不到指定的入口点脚本或可执行文件。出现这种情况的原因有以下几个:

The entrypoint script or executable is not present in the image or container.

The entrypoint script or executable is not located in the correct directory.

The entrypoint script or executable is not set to be executable.

The script name is misspelled.

There might be some compatibility issue with the image and the version of windows

要解决此问题,您可以尝试:

Check that the entrypoint script or executable is present in the container and is located in the correct directory.
Ensure that the script or executable is set to be executable.
Verify the name of the script and make sure it is spelled correctly.
Try to run the image on different version of windows or try with different image.
If nothing works, you can try to rebuild the image, including the entrypoint script or executable.

相关问题