简体   繁体   English

Windows 10 Docker - 找不到入口点

[英]Windows 10 Docker - Entrypoint not found

On my work there is a docker project with all backend setup.在我的工作中有一个带有所有后端设置的 docker 项目。 The code of dockerfile: 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.当在 Linux 上运行带有docker-compose up --build的项目时(在克隆之后,没有恶作剧)一切正常。 It finds its entrypoint.sh fine) its okay.它发现它的 entrypoint.sh 很好)没关系。 When running from windows entrypoint dont run.从 windows 入口点运行时不运行。

  • Running entrypoint from a global path like "C:/abc/abc/.."从“C:/abc/abc/..”这样的全局路径运行入口点

Please help请帮忙

I tried:我试过了:

  • Removing ENTRYPOINT and running it as CMD删除 ENTRYPOINT 并将其作为 CMD 运行
  • Adding entry point to /usr/src/freedom on my C: folder将入口点添加到我的 C: 文件夹中的 /usr/src/freedom
  • Changing paths改变路径

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"]您有一个选择是调用 shell 并执行文件,就像: 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.)但最后我认为最好的解决方案是简单地使用单个CMD指令,例如: CMD ["/usr/src/freedom/entrypoint.sh"] (我的意思是你应该删除所有CMDENTRYPOINT指令你目前拥有并使用这个。)

You can check the difference between CMD and ENTRYPOINT in the documentation and this SoF post:您可以在文档和这篇 SoF 帖子中查看CMDENTRYPOINT之间的区别:

Also, as stated in the documentation, having two CMD commands is useless since the latest one is the one that will be applied.此外,如文档中所述,拥有两个 CMD 命令是无用的,因为将应用最新的命令。

The error "entrypoint not found" in Windows 10 when using Docker typically indicates that the specified entrypoint script or executable cannot be found in the container.使用 Docker 时 Windows 10 中的错误“未找到入口点”通常表示在容器中找不到指定的入口点脚本或可执行文件。 This can occur for a few reasons:出现这种情况可能有以下几个原因:

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

To resolve this issue, you can try to:要解决此问题,您可以尝试:

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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM