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
• 16,420 points
11,200 views

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
• 42,410 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 by anonymous
Are you getting the same error?
What's the solution??

Related Questions In Docker

+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
18,657 views
+1 vote
4 answers

COPY is not working in Docker

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

answered May 6 in Docker by Emilia
2,052 views
0 votes
1 answer

Different file owner inside Docker container and in host machine Ask

Filesystems, at least in Unix- and Linux-like ...READ MORE

answered Jun 25, 2018 in Docker by Damon Salvatore
• 5,510 points
82 views
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
• 56,920 points
225 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,380 points
1,132 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
• 42,410 points
39 views