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

# https://registry.hub.docker.com/u/dockerfile/nodejs/ (builds on ubuntu:14.04)
FROM dockerfile/nodejs
MAINTAINER My Name, me@email.com
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"]
Jul 26, 2018 in Docker by Hannah
• 18,560 points
39,202 views

7 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
• 52,350 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 docker-entrypoint.sh

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", "entrypoint.sh" ]
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??
build image with --no-cache
0 votes
try to build the image with --no-cache.

I replaced the docker command from CMD /bin/bash with "jva","-jar","name-of-jar" which gave error. and after that I corrected "jva" with "java" but it was not taking the corrected form and was getting this error continously.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \".\": executable file not found in $PATH": unknown.

Then I restarted docker but no-luck, then I try the above --no-cache...which solved the problem.
answered Nov 1, 2020 by Deeptesh Agrawal

Related Questions In Docker

0 votes
1 answer
+4 votes
7 answers

If conditional in docker file

First of all, create a build_internal.sh file ...READ MORE

answered May 29, 2018 in Docker by DareDev
• 6,890 points
69,662 views
+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
11,704 views
+2 votes
1 answer
+2 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
• 58,120 points
1,194 views
+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,450 points
3,258 views
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
• 52,350 points
158 views