node.js Docker:来自守护进程的错误响应:OCI 运行时创建失败:container_linux.go:296:
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47816702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Docker: Error response from daemon: OCI runtime create failed: container_linux.go:296:
提问by pelican
I am trying to run a simple node application with express but I get this error:
我正在尝试使用 express 运行一个简单的节点应用程序,但出现此错误:
Here's my working directory:
这是我的工作目录:
I ran the following command to mount my current source code directory to /var/wwwinside 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:
我运行以下命令将我当前的源代码目录挂载到/var/www节点容器内并运行 node npm start 来启动应用程序;但我收到了上面的错误,不知道该怎么做:
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
回答by Ryan Rapp
Docker is telling you that the command hit an error.
It is trying to run the nodeimage with the command -w.
Since -wis not a command, it throws this error.
Docker 告诉您该命令遇到错误。它正在尝试node使用命令运行图像-w。由于-w不是命令,因此会引发此错误。
This is because you have written nodein a place you probably didn't mean to.
这是因为你写node的地方你可能不是故意的。
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


