Mastering Development System & Network

Kill and remove container and its dependencies in docker-compose

Do I get it right that it is impossible to remove a tree of depending containers in docker-compose, unless it is not the complete project?

I have one basic service all other containers depend on and I want to remove and to start all other containers, while keeping the main service running. However, on startup, the depending containers should check if the main service is active and start it if it’s not.

‘down’ command doesn’t take a service as an argument. ‘stop’ and ‘rm’ commands do not process the dependencies. I tried to move the main service to another YML file, but then the remaining containers cannot depend on it.

Leave a Reply

Your email address will not be published. Required fields are marked *