Docker容器不断重启

前端之家收集整理的这篇文章主要介绍了Docker容器不断重启前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在尝试牧场主.
我使用了命令:
    sudo docker run -d –restart = always -p 8080:8080 rancher / server
开始运行它.
然后我停下了容器并将其取下.但是,如果我停止并重新启动docker守护程序或重启我的笔记本电脑,并使用docker ps命令查找正在运行的容器,它将再次运行rancher服务器.如何完全停止/删除它并确保它不会再次运行.

最佳答案
注意:在issue 11008PR 15348(commit fd8b25c,docker v1.11.2)之后,您可以避免以下问题:

sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

在您目前的情况下,由于PR 19116,您可以使用docker update更新重新启动策略.

docker update --restart=unless-stopped 

然后停止容器,重新启动docker守护程序:它不会重新启动所述容器.

OP codefire指向in the comments的另一个原因:

When I first ran the start rancher server command,I didn’t notice that it was being downloaded. So I may have retried that command a couple times.

That must be why the job kept on restarting even after stopping and removing containers that was started as rancher server.
After stopping and removing 8+ containers,it finally stopped

这就是为什么我有aliases to quickly remove any stopped containers.

猜你在找的Docker相关文章