Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker: executable file not found in $PATH

Tags:

docker

I have a docker image which installs grunt, but when I try to run it, I get an error:

Error response from daemon: Cannot start container foo_1: \     exec: "grunt serve": executable file not found in $PATH 

If I run bash in interactive mode, grunt is available.

What am I doing wrong?

Here is my Dockerfile:

# https://registry.hub.docker.com/u/dockerfile/nodejs/ (builds on ubuntu:14.04) FROM dockerfile/nodejs  MAINTAINER My Name, [email protected]  ENV HOME /home/web WORKDIR /home/web/site  RUN useradd web -d /home/web -s /bin/bash -m  RUN npm install -g grunt-cli RUN npm install -g bower  RUN chown -R web:web /home/web USER web  RUN git clone https://github.com/repo/site /home/web/site  RUN npm install RUN bower install --config.interactive=false --allow-root  ENV NODE_ENV development  # Port 9000 for server # Port 35729 for livereload EXPOSE 9000 35729 CMD ["grunt"] 
like image 997
Steve Lorimer Avatar asked Nov 26 '14 21:11

Steve Lorimer


People also ask

Which executable file is not found in $PATH?

You might have encountered the error executable file not found in $PATH when you are trying to run your docker container. There could be many reasons for an error like this. But in simple words, the docker can not find the binary which you want to run inside the docker container.

Where is docker file path?

Traditionally, the Dockerfile is called Dockerfile and located in the root of the context. You use the -f flag with docker build to point to a Dockerfile anywhere in your file system. $ docker build -f /path/to/a/Dockerfile .

What is difference between CMD and entrypoint?

Differences between CMD & ENTRYPOINT CMD commands are ignored by Daemon when there are parameters stated within the docker run command while ENTRYPOINT instructions are not ignored but instead are appended as command line parameters by treating those as arguments of the command.

What is a Workdir in docker?

WORKDIR. The WORKDIR instruction sets a working directory for other Dockerfile instructions, such as RUN , CMD , and also the working directory for running instances of the container image.


1 Answers

This was the first result on google when I pasted my error message, and it's because my arguments were out of order.

The container name has to be after all of the arguments.

Bad:

docker run <container_name> -v $(pwd):/src -it 

Good:

docker run -v $(pwd):/src -it <container_name> 
like image 88
Kabir Sarin Avatar answered Sep 26 '22 06:09

Kabir Sarin