当一个容器通过docker-compose停止时如何停止所有容器? [英] How to stop all containers when one container stops with 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屋!