I'm using docker swarm to run containers. I need some of my containers to have privileged rights, and the way achieve this with docker swarm is to use Docker in Docker. So my services utilize the docker image and then start the image I want to use with privileged rights when they start. However, when I remove my services, the inner docker containers are left running.
Is there a way to remove these dangling containers automatically when the service that starts them is removed? I can manually kill the containers by checking their ids with docker ps
and then use docker kill
, but that it is far from optimal.