我正在尝试停止并删除一个 docker - 容器。
我从 docker turorial 第 1 部分开始,现在是第 2 部分: https ://docs.docker.com/get-started/part2/#run-the-app
我从那里复制了源代码。它也可以在这里找到: https ://gist.github.com/sl5net/8b510bc0d3e00c474575e010003406c1
在这里你可以看到我的控制台的样子:
Microsoft Windows [Version 10.0.16299.431]
C:\fre\private\docker\test18-05-14_05-27>docker build -t friendlyhello .
Sending build context to Docker daemon 5.12kB
no matching manifest for windows/amd64 in the manifest list entries
BTW 解决方案:我换成 linux 容器(右键单击> docker 图标上的上下文菜单)
C:\fre\private\docker\test18-05-14_05-27>docker build -t friendlyhello .
... Successfully built itsdangerous MarkupSafe
Successfully tagged friendlyhello:latest
C:\fre\private\docker\test18-05-14_05-27>docker run -p 4000:80 friendlyhello
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
C:\fre\private\docker\test18-05-14_05-27>docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
friendlyhello latest 7d4d1e0f78e6 8 minutes ago 151MB
python 2.7-slim 46ba956c5967 9 days ago 140MB
C:\fre\private\docker\test18-05-14_05-27>docker container stop friendlyhello
Error response from daemon: No such container: friendlyhello
C:\fre\private\docker\test18-05-14_05-27>docker rm -f friendlyhello
Error: No such container: friendlyhello
原文由 SL5net 发布,翻译遵循 CC BY-SA 4.0 许可协议
没有名称为
friendlyhello
的容器可用,因为您只是使用docker run -p 4000:80 friendlyhello
运行容器,这里friendlyhello
是图像的名称,而不是容器的名称姓名。通过给它一个如下名称 来 运行该容器:-
在这种情况下,您将能够使用以下命令停止并删除该容器
或者,如果在没有给容器命名的情况下不运行,则必须在命令中使用容器的 ID 来停止和删除,即使在各种其他命令中,您也将使用 ID 来引用该容器