I have a Node.js project that is using npm scripts. An excerpt from package.json
:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build-all": "./node_modules/.bin/webpack --progress --config ./webpack/client.config.js && ./node_modules/.bin/webpack --progress --config ./webpack/server.config.js",
"web": "python -m SimpleHTTPServer 8888",
"server" : "./node_modules/.bin/electron-spawn ./dist/server.js"
},
I'm creating a Dockerfile
for this project. I was hoping to use npm as the ENTRYPOINT for the image. In the Dockerfile I have:
ENTRYPOINT ['/usr/local/bin/npm' 'run']
when I try to start a hcontainer form the image it says it cannot find npm
root@vagrant-ubuntu-trusty-64:/home/vagrant# docker run my_image web
web: 1: web: [/usr/local/bin/npm: not found
if I start a shell in the image it looks like the npm executable is at that path
root@vagrant-ubuntu-trusty-64:/home/vagrant# docker run -i -t --entrypoint /bin/bash my_image
root@5e7362a64412:/# ls /usr/local/bin/npm
/usr/local/bin/npm
The issue seems to be due to the single quotes in the ENTRYPOINT. Could you check if using the double quotes the issue solves?
ENTRYPOINT ["/usr/local/bin/npm", "run"]
According to the Docker guide, there are only two forms to write the ENTRYPOINT:
ENTRYPOINT ["executable", "param1", "param2"]
ENTRYPOINT command param1 param2
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