Docker: Error response from daemon: OCI runtime create failed: container_linux.go:296:

放肆的年华 提交于 2019-12-05 15:37:39

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/47816702/docker-error-response-from-daemon-oci-runtime-create-failed-container-linux-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!