I am trying to run a simple node application with express but I get this error:
Here's my working directory:
I ran the following command to mount my current source code directory to /var/www
inside the node container and run node npm start to start up the app;
but I get the error above and not sure what to do:
docker run -p 8085:3000 -v /home/joel/workspace/plural_docker_webdev:/var/www node -w "/var/www" node npm start
And I get this error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"-w\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled
Docker is telling you that the command hit an error.
It is trying to run the node
image with the command -w
.
Since -w
is not a command, it throws this error.
This is because you have written node
in a place you probably didn't mean to.
Your command is being interpreted like this:
docker run -p [port_info] -v [volume_info] node [command]
You can rewrite your command like so and it should work fine:
docker run -p 8085:3000 -v /home/joel/workspace/plural_docker_webdev:/var/www -w "/var/www" node npm start
I had the same issue. My problem was that we did not give it enough memory. Went with the recommended minimum of 2GB of memory. turns out other resources were consuming most of it. gave it 4GB, rebooted & it works fine now.
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