By default docker-compose up
keeps running even if some of the containers terminate and restart
is set to no
.
Is there a configuration to tell it to terminate (and stop all containers) when one of my containers finishes (the process in CMD terminates)?
Bonus points if it gets the exit code from the process of that container
Looks like you want to supply the
--abort-on-container-exit
command line parameter to docker-compose
. See https://docs.docker.com/compose/reference/up/
To get an exit code:
--exit-code-from SERVICE
will return the exit code of SERVICE
, and implies --abort-on-container-exit