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
Kenil Vasani
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:
You can rewrite your command like so and it should work fine: