如何停止和删除使用“始终重启”选项启动的Docker容器? [英] How can I stop and delete a docker container launched with restart always option?

查看:503
本文介绍了如何停止和删除使用“始终重启”选项启动的Docker容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行了一些带有-始终重启的容器。



它的工作原理非常好,以至于我现在很难立即停止这些容器:)



我尝试过:

  sudo docker停止容器&& sudo docker rm -f容器

但是容器仍会重新启动。



docker文档解释了重启策略,

解决方案

非常感谢那些花时间响应的人。

>

如果直接使用docker,Bryan是正确的 sudo docker rm -f container 就足够了。



我的问题主要是我使用p来部署docker映像并运行容器。我使用此模块,它在/ etc / init中为新贵进程管理器创建了条目。 / p>

我认为,我的问题在于,流程管理器和docker之间存在某种不兼容性。



要停止容器,只需 sudo stop docker-container



有关管理Docker容器运行的更多信息可以可以在码头工人网站上找到


I run some containers with the option --restart always.

It works good, so good, that I have now difficulties to stop these containers now :)

I tried :

sudo docker stop container && sudo docker rm -f container

But the container still restarts.

The docker documentation explains the restart policies, but I didn't find anything to resolve this issue.

解决方案

Many thanks for those who takes time to respond.

If you use docker directly, Bryan is right sudo docker rm -f container is enough.

My problem was mainly that I use puppet to deploy docker images and run containers. I use this module and it creates entries in /etc/init for the upstart process manager.

I think, my problem whas that, some kind of incompatibilities between the process manager and docker.

In this situation, to halt a container, simply sudo stop docker-container.

More informations on managing docker container run can be found on the docker website

这篇关于如何停止和删除使用“始终重启”选项启动的Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆