1

I found the following discussion re: getting a

"executable file not found in $PATH"

That solved my problem, but only partially. On my last command I am specifying:

CMD /home/ubuntu/node-v0.10.16-linux-x64/bin/node launch.js

The image builds without any errors or warnings. However, when I docker run <image>, I am now getting the following error:

/bin/sh: 1: /home/ubuntu/node-v0.10.16-linux-x64/bin/node: not found

That directory is included in my ENV PATH statement. What else do I need to look for?

Community
  • 1
  • 1
tlwtheq
  • 29
  • 6
  • By editing my question so severely you altered the context I was setting to ask it. I wish you wouldn't have. – tlwtheq Oct 22 '15 at 17:01

1 Answers1

0

That directory is included in my ENV PATH statement

That doesn't seem to be relevant, since you are providing the full path of the command.
It should simply mean that full path does not exist in the running container.

In order to check that:

  • remove your CMD in your Dockerfile
  • build and run your container
  • open a bash in your running container (unless the default docker run opens a bash session)

That is:

docker exec -it <yourContainer> bash
ls /home/ubuntu/node-v0.10.16-linux-x64/bin/node

Or:

docker run -it --rm <yourContainer> bash
which node

It should be in /usr/sbin/node.
Since /usr/sbin/ is in the root account's $PATH, the CMD can simply be:

CMD [ "node", "/path/to/your/launch.js" ]
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Running docker exec -it . (Oh, and before that, docker run didn't seem to do anything either. – tlwtheq Oct 22 '15 at 18:15
  • @tlwtheq what is your `Dockerfile`? What is its base image (`FROM` directive)? Note that `docker run` would use ``, not ``: `docker run --name `: run a container named `` from the image named ``. – VonC Oct 22 '15 at 18:22
  • FROM ubuntu:12.04 My container name and my image name are the same. – tlwtheq Oct 22 '15 at 18:33
  • @tlwtheq in your Dockerfile, did you change the `ENTRYPOINT`? In order to have a running container, you should do a `docker run -it --rm --name bash`: that would open a container with a bash (instead of the default `CMD`, which does not execute anyway). Once in the bash, you can explore the container and see if the folder is there. – VonC Oct 22 '15 at 19:33
  • Interesting. I just did a modified version of what you suggested. I.e., docker run -it . This lands me in /, as username root. The ID root certainly cannot see any version of "node", although an 'echo $PATH' has my container's path in it. As I am famous for saying, "Now what?" Oh, and I am in bash according to 'echo $SHELL'. – tlwtheq Oct 23 '15 at 12:32
  • Also forgot to mention I just plain copied the "node" executable into my container's directory before the docked build. No difference. – tlwtheq Oct 23 '15 at 13:15
  • Oh, another thing. When I land in the root directory, the docker executable isn't visible either. "bash: docker: command not found" – tlwtheq Oct 23 '15 at 13:52
  • @tlwtheq the id root is the default one: you can change the user with a `docker run -u anotheruser` – VonC Oct 23 '15 at 14:49
  • @tlwtheq "I just plain copied the "node" executable into my container's directory ": do you mean you have a `COPY` directive in your Dockerfile? If not, how exactly (what did you type) did you copy anything in your container *before* a docker build? You `docker build` first (an image), then you run a container (from that built image) – VonC Oct 23 '15 at 14:51
  • I mean I literally copied the node tool, cp node, into the directory where I am performing the build, then did the build. – tlwtheq Oct 23 '15 at 15:13
  • When I specified my username the System couldn't find it. Error response from daemon: Cannot start container ebd9f7eb6c99968b3067bd384009e9ae8c10706fb424368745c217c8b246d0f5: [8] System error: Unable to find user ubuntu – tlwtheq Oct 23 '15 at 15:18
  • @tlwtheq that copy would have any effect if you then have on the Dockerfile used by docker build a `COPY node /somewhere` directive. – VonC Oct 23 '15 at 15:25
  • @tlwtheq I agree that specifying your host username is unknown in a container environment. Why root is a problem here? – VonC Oct 23 '15 at 15:25
  • I don't understand the sentence: "that copy would have any effect if you then have on the Dockerfile used by docker build a COPY node /somewhere directive." The root ID cannot see my launch command, or the node executable. – tlwtheq Oct 23 '15 at 15:40
  • @tlwtheq the root id can see anything present in the container: it has full access. Regarding the copy, copying anything in the host has no effect on the resulting image, unless your Dockerfile COPY it (see https://docs.docker.com/reference/builder/#copy) – VonC Oct 23 '15 at 15:41
  • I think my Dockerfile is not right, in more ways than one, but don't want to post it. Is there some way I can email it to you? – tlwtheq Oct 23 '15 at 16:35
  • @tlwtheq sure, but an interactive session would be more effective. I cannot create a chat room (you have not yet enough rep: http://stackoverflow.com/help/privileges/chat), so look me up in Google Hangout (https://plus.google.com/u/0/+DanVonC1) – VonC Oct 23 '15 at 17:30
  • OK...got your picture up. Now what? – tlwtheq Oct 23 '15 at 18:31