Home > Net >  executable file not found in $PATH: unknown
executable file not found in $PATH: unknown

Time:04-23

Trying to figure out why my 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"]

throws the following error when run:

> 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.

I've tried seemingly everything: using CMD instead of ENTRYPOINT, modifying the COPY dest to ./gallery-dl.ps1, changing the order of commands. I've prepended #!/usr/bin/pwsh -File to the ps1 script (as instructed in a different question of mine). When I attach into the container and ls it shows all of my mounts and gallery-dl.ps itself where it should be and where I'm supposedly calling it:

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

The only thing that works is removing WORKDIR but I actually need that, I can't just run everything in root.

CodePudding user response:

Two things: Make sure the file is marked as executable. And since /mydir isn't in your path, you need to tell Docker to look for the script in the current directory by adding ./ in front of the name.

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