简体   繁体   中英

OCI runtime exec failed: exec failed: (...) executable file not found in $PATH": unknown

I have dockerized an app which has ffmpeg installed in it via libav-tools. The app launches without problem, yet the problem occured when fluent-ffmpeg npm module tried to execute ffmpeg command, which was not found. When I wanted to check the version of the ffmpeg and the linux distro set up in the image, I used sudo docker exec -it c44f29d30753 "lsb_release -a" command, but it gave the following error: OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \\"lsb_release -a\\": executable file not found in $PATH": unknown

Then I realized that it gives me the same error with all the commands that I try to run inside the image or the container.

OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"ffmpeg -a\": executable file not found in $PATH": unknown

This is my Dockerfile:

FROM ubuntu:xenial
FROM node
RUN apt-get -y update
RUN apt-get --yes install libav-tools
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm install
COPY . /usr/src/app
RUN npm run build
ENV NODE_ENV production
EXPOSE 8000
CMD ["npm", "run", "start:prod"]

I would kindly ask for your help. Thank you very much!

This happened to me on windows. Any of these commands will work

On Windows CMD (not switching to bash)

docker exec -it <container-id> /bin/sh

On Windows CMD (after switching to bash)

docker exec -it <container-id> //bin//sh

or

winpty docker exec -it <container-id> //bin//sh

On Git Bash

winpty docker exec -it <container-id> //bin//sh

NB: You might need to run use /bin/bash or /bin/sh , depending on the shell in your container.

The reason is documented in the ReleaseNotes file of Git and it is well explained here - Bash in Git for Windows: Weirdness...

"The cause has to do with trying to ensure that posix paths end up being passed to the git utilities properly. For this reason, Git for Windows includes a modified MSYS layer that affects command arguments."

I had this due to a simple ordering mistake on my end. I called

[WRONG] docker run <image> <arguments> <command>

When I should have used

docker run <arguments> <image> <command>

Same resolution on similar question: https://stackoverflow.com/a/50762266/6278

Get rid of your quotes around your command. When you quote it, docker tries to run the full string "lsb_release -a" as a command, which doesn't exist. Instead, you want to run the command lsb_release with an argument -a , and no quotes.

sudo docker exec -it c44f29d30753 lsb_release -a

Note, everything after the container name is the command and arguments to run inside the container, docker will not process any of that as options to the docker command.

If @papigee does solution doesn't work, maybe you don't have the permissions.

I tried @papigee solution but does't work without sudo.

I did :

sudo docker exec -it <container id or name> /bin/sh
docker exec -it <containerId> sh

I solved this with this commands:

1- Run the container

# docker run -d <image-name>

2- List containers

   # docker ps -a

3- Use the container ID

# docker exec -it <container-id> /bin/sh

@papigee should work on Windows 10 just fine. I'm using the integrated VSCode terminal with git bash and this always works for me.

winpty docker exec -it <container-id> //bin//sh

I was running into this issue and it turned out that I needed to do this:

docker run ${image_name} bash -c "${command}"

Hope that helps someone who finds this error.

What I did to solve was simply:

  1. Run docker ps -a
  2. Check for the command of the container (mine started with /bin/sh)
  3. Run docker-compose exec < name_of_service > /bin/sh (if that is what started your command

This is for solving when using docker compose

You can use another shell to execute the same command:

Error I get when i execute:

[jenkins@localhost jenkins_data]$ docker exec -it mysqldb \bin\bash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"binsh\": executable file not found in $PATH": unknown

Solution: When I execute it with below command, using bash shell it works:

[jenkins@localhost jenkins_data]$ docker exec -it mysqldb bash
root@<container-ID>:/#

This has happened to me. My issue was caused when I didn't mount Docker file system correctly, so I configured the Disk Image Location and re-bind File sharing mount, and this now worked correctly. For reference, I use Docker Desktop in Windows.

在我的情况下,我保存了 docker 图像,而不是在另一台机器上加载它,我导入了它,这是非常不同的,并导致我出现与此类似的错误。

这对我有用

docker exec -it <container ID> sh

you have to run like below:

docker exec sh -c 'echo "$ENV_NAME"'

I had windows line endings in a shell script. change to LF dos2unix

docker exec -it test_db /bin/sh 或 docker exec -it test_db sh 对我有用,而 docker exec -it test_db bash 对我不起作用

对于高山码头图像

docker exec -it <container-id> sh
docker exec -it /bin/bash -c "ls /"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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