docker: executable file not found in $PATH

0 votes

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

grunt is available when I try to execute bash in interactive mode

What am I doing wrong?

Here’s my dockerfile

# (builds on ubuntu:14.04)
FROM dockerfile/nodejs
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 /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"]
Jul 26, 2018 in Docker by Hannah
• 18,070 points

6 answers to this question.

0 votes
Try to build the docker using CMD[“grunt”]

When you build docker using grunt it uses another shell or without a shell to execute the command where $PATH might not be set.

If you specify your command as a regular string (e.g. CMD grunt) then the string after CMD will be executed with /bin/sh -c.
answered Jul 26, 2018 by Kalgi
• 51,890 points
0 votes
Check your arguments that you've passed. This error is produced sometimes when arguments are out of order.
answered Dec 10, 2018 by Stuti
0 votes

Try to run it with the following command:

docker run -v $(pwd):/src -it <container_name>
answered Dec 10, 2018 by Kailash
0 votes

This error can occur when your executable file do not have the execute permission. 

chmod +x

This might help.

answered Dec 10, 2018 by Mohit
0 votes

Add "#!/bin/bash" to the top of your entrypoint file didn't help.

ENTRYPOINT [ "bash", "" ]
answered Dec 10, 2018 by Swaroop
0 votes
file not found in $PATH
answered May 9, 2019 by anonymous
Are you getting the same error?
What's the solution??

Related Questions In Docker

0 votes
1 answer
+2 votes
6 answers

If conditional in docker file

You can use the test command RUN test ...READ MORE

answered Dec 10, 2018 in Docker by Shushant
+1 vote
4 answers

COPY is not working in Docker

I had the exact same issue. I ...READ MORE

answered May 6, 2019 in Docker by Emilia
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,550 points
+6 votes
4 answers

Error: Docker saying "bad file descriptor"

The solution was easy enough. Add these ...READ MORE

answered Mar 26, 2018 in Docker by DragonLord999
• 8,420 points
0 votes
1 answer

How to list containers in Docker

To show only running containers use the given command: docker ...READ MORE

answered Jul 20, 2018 in Docker by Kalgi
• 51,890 points