executable file not found in $PATH: unknown - docker

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.

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

Docker exec container pytest fail

I am using the dev image so i can have the cuda compiler, now the issue is that when running the CI, as below I get that error, but if I build the standard container (commented line in dockerfile).
CONTAINER=$(docker run -d gpu-test)
docker exec $CONTAINER pytest
OCI runtime exec failed: exec failed: unable to start container process: exec: "pytest": executable file not found in $PATH: unknown
Dockerfile:
# Pulls the basic Image from NVIDIA repository
FROM rapidsai/rapidsai-dev:22.04-cuda11.5-devel-ubuntu20.04-py3.9
# FROM rapidsai/rapidsai:22.04-cuda11.5-runtime-ubuntu20.04-py3.9
# Updates OS libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
--fix-missing git python3-setuptools python3-pip build-essential libcurl4-gnutls-dev \
zlib1g-dev rsync vim nano cmake tabix
# Install libraries needed in the examples
RUN /opt/conda/envs/rapids/bin/pip install \
scanpy==1.9.1 wget pytabix dash-daq \
dash-html-components dash-bootstrap-components dash-core-components \
utils pytest
RUN /opt/conda/envs/rapids/bin/pip install \
torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
WORKDIR /workspace
ENV HOME /workspace

Docker File Error no such file or directory: unkno

Trying to build a pkt miner image in order to deploy to akash.
Keep getting this error
Error invoking remote method 'docker-start-container':
Error: (HTTP code 400) unexpected -
OCI runtime create failed:
container_linux.go:367: starting container process caused: exec:
"./target/release/packetcrypt":
stat ./target/release/packetcrypt: no such file or directory: unknown```
My Dockerfile
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y \
build-essential \
curl
RUN apt-get update
RUN curl -y --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
RUN apt install make
RUN apt-get -y update
RUN apt-get -y install gcc git
RUN apt-get -y update
RUN git clone https://github.com/cjdelisle/packetcrypt_rs
ENV PATH=$PATH:/usr/local/packetcrypt_RS
CMD [ "~/", ".cargo/bin/cargo", "build", "--release" ]
CMD [ "./target/release/packetcrypt", "ann", "-p", "pkt1qd5skpmelkwvzy5vppqhafvmx0n5kqy97eglp00", "http://pool.pkteer.com" ]
I've tried adding WORKDIR
Can't seem to get rid of the error no matter what I do. I have a feeling im missing something obvious

How to fix error occurring during Docker image build: "E: Unsupported file /tmp given on commandline"

I am trying to build an image from Dockerfile and I am getting below error:
E: Unsupported file /tmp given on commandline
This is my dockerfile:
FROM python:3.7-slim-stretch
LABEL version="0.1"
ENV DAEMON_RUN=true
ENV SPARK_VERSION=2.4.4
ENV HADOOP_VERSION=2.7
ENV SCALA_VERSION=2.12.4
ENV SCALA_HOME=/usr/share/scala
ENV SPARK_HOME=/spark
RUN apt-get update -yqq
RUN apt-get install -yqq --no-install-recommends \
wget \
tar \
bash \
vim \
less \
RUN cd "/tmp"
But when i run below line I'm getting mentioned error:
docker build --rm -t test/docker-airflow-spark -f Dockerfile-Spark >.
If i remove the last command : RUN cd "/tmp"
And i try to connect ssh to the container the folder exists
Any ideas?
you need to edit the last line in apt-get command change less \ to less
docker thinks that RUN cd "/tmp" is a parameter for apt-get
anyway you should use WORKDIR if you want to use /tmp for further steps

copy or add command not executed on docker hub

This dockerfile works as expected on my laptop. But it fails if I use automated builds on docker hub.
FROM ubuntu
# Install required software via apt and pip
RUN apt-get -y update && \
apt-get install -y \
awscli \
python \
python-pip \
software-properties-common \
&& add-apt-repository ppa:ubuntugis/ppa \
&& apt-get -y update \
&& apt-get install -y \
gdal-bin \
&& pip install boto3
# Copy Build Thumbnail script to Docker image and add execute permissions
COPY build-thumbnails.py build-thumbnails.py
RUN chmod +x build-thumbnails.py
The error is:
Step 6/7 : COPY build-thumbnails.py build-thumbnails.py
COPY failed: stat /var/lib/docker/tmp/docker-builder259560514/build-thumbnails.py: no such file or directory
The repo is here...
https://github.com/shantanuo/docker/blob/master/batch/Dockerfile
Why would copy or add command not work for automated builds?
Seems like other people have had the same issue see here:
https://forums.docker.com/t/docker-build-failing-on-docker-hub/76191/2
The solution is to set the build context appropriately so that the relative path >in the Dockerfile COPY is correct.
In your Docker Hub repository go to “Builds” and click on “Configure Automated >Builds”. There you can set the “Build Context” for each build rule.
Check the last answer on this page too:
https://github.com/docker/hub-feedback/issues/811
Let me know if that helps!

How to save my installations on Ubuntu image into Docker

Docker Codes
# Import Ubuntu image to Docker
docker pull ubuntu:16.04
docker run -it ubuntu:16.04
# Instsall Python3 and pip3
apt-get update
apt-get install -y python3 python3-pip
# Install Selenium
pip3 install selenium
# Install BeautifulSoup4
pip3 install beautifulsoup4
# Install library for PhantomJS
apt-get install -y wget libfontconfig
# Downloading and installing binary
mkdir -p /home/root/src && cd &_
tar jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
cd phantomjs-2.1.1-linux-x86_64/bin/
cp phantomjs /usr/local/bin/
# Installing font
apt-get install -y fonts-nanum*
Question
I am trying to import Ubuntu image to docker and install serveral packages inscluding python3, pip3, bs4, and PhantomJs. Then I want to save all this configurations in Docker as "ubuntu-phantomjs". As I am currently on Ubuntu image, anything that starts with 'docker' command do not work. How could I save my image?
Here is the dockerfile:
# Import Ubuntu image to Docker
FROM ubuntu:16.04
# Install Python3, pip3, library and fonts
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
wget libfontconfig \
fonts-nanum*
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install selenium beautifulsoup4
# Downloading and installing binary
RUN mkdir -p /home/root/src && cd &_ tar jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2 && cd phantomjs-2.1.1-linux-x86_64/bin/ && cp phantomjs /usr/local/bin/
Now after saving the code in file named dockerfile, open a terminal in the same directory as the one where file is stored, and run following command:
$ docker build -t ubuntu-phantomjs .
-t means that the target is ubuntu-phantomjs and . means that the context for docker is the current directory. The above dockerfile is not a standard one, and does not follow all good practices mentioned here. You can change this file according to your needs, read the documentations for more help.

Resources