docker实践之从新镜像启动容器报错解决
按照书中所写,输入以下命令:
$sudodockerrun-d-p80--namestatic_webyorkz0909/static_web\nginx-g"daemonoff;"
来启动新的容器,容器貌似启动了,但是会报以下错误:
35b5d1f047a51373ca71190b0eed504ba0540c32427f4637b967c7b4ad7fa217
docker:Errorresponsefromdaemon:invalidheaderfieldvalue"ociruntimeerror:container_linux.go:247:starting
containerprocesscaused\"exec:\\\"nginx\\\":executablefilenotfoundin$PATH\"\n".
搜索了一下原因,可能是因为在启动的时候命令不对,于是在命令中加入/bin/sh,重新起了个名字static_web2,否则会报错命名冲突:
报错内容:
docker:Errorresponsefromdaemon:Conflict.Thename"/static_web1"isalreadyinusebycontainer
35b5d1f047a51373ca71190b0eed504ba0540c32427f4637b967c7b4ad7fa217.Youhavetoremove(orrename)thatcontainertobeabletoreusethatname..
输入正确的命令:
$sudodockerrun-d-p80--namestatic_web2yorkz0909/static_web /bin/sh\nginx-g"daemonoff;" d918395d551b582ae1a446ff119d4832fe9bfb4a65e91b2ea1a75e36ffec6743
运行后没有报错,当然,并不知道具体为什么,猜想可能是因为指定运行的命令,加入了指定的/bin/sh命令后就可以了。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下