Docker:来自守护进程的错误响应:OCI 运行时创建失败:container_linux.go:296: [英] Docker: Error response from daemon: OCI runtime create failed: container_linux.go:296:
问题描述
我正在尝试使用 express 运行一个简单的节点应用程序,但出现此错误:
I am trying to run a simple node application with express but I get this error:
这是我的工作目录:
我运行以下命令将我当前的源代码目录挂载到节点容器内的 /var/www
并运行 node npm start 启动应用程序;但我收到上面的错误,不知道该怎么办:
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
我得到这个错误:
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 告诉你命令遇到错误.它正在尝试使用命令 -w
运行 node
映像.由于 -w
不是命令,所以会抛出这个错误.
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.
这是因为你在一个你可能不打算写的地方写了 node
.
This is because you have written node
in a place you probably didn't mean to.
您的命令被这样解释:
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
这篇关于Docker:来自守护进程的错误响应:OCI 运行时创建失败:container_linux.go:296:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!