本地镜像默认工作目录为:/tmp/project,根据该镜像运行容器时报错,原因是:挂载的目录为/tmp/client/,而执行 npm i 命令时,进入的是client目录,解决方式:将命令修改为以下即可:
cd /tmp/client/ && npm i
docker 运行时报错:文章来源:https://www.toymoban.com/news/detail-610878.html
+ docker run -e GIT_SSL_NO_VERIFY=1 -v /home/workspace/student_PR-112:/tmp/client/ test/basis/web:v1 sh -c 'cd client && npm i'
docker: Error response from daemon: OCI runtime create failed: container_linux.go:318: starting container process caused "chdir to cwd (\"/tmp/project\") set in config.json failed: no such file or directory": unknown.
time="2023-05-10T15:37:43+08:00" level=error msg="error waiting for container: context canceled"
修改后的代码:文章来源地址https://www.toymoban.com/news/detail-610878.html
docker run -e GIT_SSL_NO_VERIFY=1 -v /home/workspace/student_PR-112:/tmp/client/ test/basis/web:v1 sh -c 'cd /tmp/client/ && npm i'
到了这里,关于docker: Error response from daemon: OCI runtime create failed: container_linux.go:318 no such file的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!