I've been banging my head against the wall on this one for a while and need a little help.
I have a docker container built from a Dockerfile. When I try to run that container (either interactively [-i] or detached [-d]), it produces the following error:
2014/06/04 21:17:40 exec: "node": executable file not found in $PATH
This is how I'm trying to start the container (made generic for security reasons):
sudo docker run -i -t -p port:port containername:containerversion node /path/to/node/app/nodeapp.js
What is troublesome and confusing is that when I run the container without that command appended, I am able to cd into the directory /path/to/node/app and run:
node nodeapp.js
This works fine for me. Additionally, when I compare the contents of the "which node" command and the output of "echo $PATH", I see that everything is kosher. So, why in the heck does this refuse to acknowledge that I am its master and it should do what I say?
nodejs
should be work.
I don't know why, but it installed named nodejs
not node
in my case.
In your Dockerfile, ensure your WORKDIR
is set and the CMD
instruction looks like one of the following:
CMD ["npm", "start"]
or
CMD ["node", "nodeapp.js"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With