Can somehow with docker or docker-compose run container B before container A stop?
docker-compose support trigger event or something like that?
DevOps Stack Exchange is a question and answer site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure. It only takes a minute to sign up.Sign up to join this community
If you mean make sure that container A does not execute and then exit then no. Docker containers will stop if the container crashes or if the main process exits.
However, if you are attempting to run container B and it is dependent on container A, I think the depends_on flag may be what you are looking for. This will allow you to ensure that service B will run after service A is started. However, you may need to add something to service A that ensures that it is ready before attempting to connect to it (e.g. a database).