当一个容器用 docker-compose 停止时,如何停止所有容器? [英] How to stop all containers when one container stops with docker-compose?

查看:412
本文介绍了当一个容器用 docker-compose 停止时,如何停止所有容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到最近,当一个人为一堆容器做 docker-compose up 并且其中一个启动的容器停止时,所有容器都停止了.情况不再如此,因为 https://github.com/docker/compose/issues/741 这对我们来说真的很烦人:我们使用 docker-compose 运行 selenium 测试,这意味着启动应用程序服务器,启动 selenium hub + 节点,启动测试驱动程序,然后在测试驱动程序停止时退出.

Up until recently, when one was doing docker-compose up for a bunch of containers and one of the started containers stopped, all of the containers were stopped. This is not the case anymore since https://github.com/docker/compose/issues/741 and this is a really annoying for us: We use docker-compose to run selenium tests which means starting application server, starting selenium hub + nodes, starting tests driver, then exiting when tests driver stops.

有没有办法恢复旧的行为?

Is there a way to get back old behaviour?

推荐答案

您可以使用:

docker-compose up --abort-on-container-exit

docker-compose up --abort-on-container-exit

如果您的一个容器停止,这将停止所有容器

Which will stop all containers if one of your containers stops

这篇关于当一个容器用 docker-compose 停止时,如何停止所有容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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