I am currently running a docker-compose stack for basic integration tests with a protractor test runner, a nodejs server serving a web page and a wildfly server serving a java b
You can use these docker-compose parameters to achieve that:
--abort-on-container-exit
Stops all containers if any container was
stopped.
--exit-code-from
Return the exit code of the selected service
container.
For example, having this docker-compose.yml
:
version: '2.3'
services:
elasticsearch:
...
service-api:
...
service-test:
...
depends_on:
- elasticsearch
- service-api
The following command ensures that elasticsearch
and service-api
go down after service-test
is finished, and returns the exit code from the service-test
container:
docker-compose -f docker-compose.yml up \
--abort-on-container-exit \
--exit-code-from service-test