欢迎来到代码驿站!

当前位置:首页 >

docker实践之从新镜像启动容器报错解决

时间:2020-10-13 13:22:10|栏目:|点击:

按照书中所写,输入以下命令:

$ sudo docker run -d -p 80 --name static_web yorkz0909/static_web \ nginx -g "daemon off;"

来启动新的容器,容器貌似启动了,但是会报以下错误:

35b5d1f047a51373ca71190b0eed504ba0540c32427f4637b967c7b4ad7fa217
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting
container process caused \"exec: \\\" nginx\\\": executable file not found in $PATH\"\n".

搜索了一下原因,可能是因为在启动的时候命令不对,于是在命令中加入/bin/sh,重新起了个名字static_web2,否则会报错命名冲突:

报错内容:

docker: Error response from daemon: Conflict. The name "/static_web1" is already in use by container
35b5d1f047a51373ca71190b0eed504ba0540c32427f4637b967c7b4ad7fa217. You have to remove (or rename) that container to be able to reuse that name..

输入正确的命令:

$ sudo docker run -d -p 80 --name <span style="color:#FF0000;">static_web2</span> yorkz0909/static_web <span style="color:#FF0000;">/bin/sh</span> \ nginx -g "daemon off;"
d918395d551b582ae1a446ff119d4832fe9bfb4a65e91b2ea1a75e36ffec6743 

运行后没有报错,当然,并不知道具体为什么,猜想可能是因为指定运行的命令,加入了指定的/bin/sh命令后就可以了。

上一篇:Ghost Windows XP SP2 龙卷风纯净版 V1.2 下载地址

栏    目:

下一篇:R语言ggplot2边框背景去除的实现

本文标题:docker实践之从新镜像启动容器报错解决

本文地址:http://www.codeinn.net/misctech/10862.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有