繁体   English   中英

在 $PATH 中找不到可执行文件:未知

[英]executable file not found in $PATH: unknown

试图弄清楚为什么我的 dockerfile:

FROM mcr.microsoft.com/powershell:ubuntu-focal
RUN apt-get -qq -y update && \
    apt-get -qq -y upgrade && \
    apt-get -qq -y install curl ca-certificates python3-pip exiftool mkvtoolnix
RUN pip3 install gallery-dl yt-dlp
WORKDIR /mydir
COPY gallery-dl.ps1 .
ENTRYPOINT ["gallery-dl.ps1"]

运行时抛出以下错误:

> docker build --file gallery-dl.dockerfile --tag psa .
> docker run -it --rm --name psatest psa
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "gallery-dl.ps1": executable file not found in $PATH: unknown.

我似乎尝试了所有方法:使用 CMD 而不是 ENTRYPOINT,将 COPY dest 修改为./gallery-dl.ps1 ,更改命令的顺序。 我已经将#!/usr/bin/pwsh -File到 ps1 脚本中(按照我的另一个问题中的指示)。 当我附加到容器中并 ls 它显示我所有的坐骑和gallery-dl.ps本身应该在哪里以及我应该在哪里调用它:

PS /mydir> ls
conf  gallery-dl.ps1  output

唯一可行的是删除 WORKDIR 但我实际上需要它,我不能只在 root 中运行所有内容。

两件事:确保文件被标记为可执行文件。 由于/mydir不在您的路径中,您需要通过在名称前添加./来告诉 Docker 在当前目录中查找脚本。

FROM mcr.microsoft.com/powershell:ubuntu-focal
RUN apt-get -qq -y update && \
    apt-get -qq -y upgrade && \
    apt-get -qq -y install curl ca-certificates python3-pip exiftool mkvtoolnix
RUN pip3 install gallery-dl yt-dlp
WORKDIR /mydir
COPY gallery-dl.ps1 .
RUN chmod +x gallery-dl.ps1
ENTRYPOINT ["./gallery-dl.ps1"]

暂无
暂无

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

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