I have a setup where users log into the host machine via PuTTY and can spawn Docker containers for their use.
The Docker command looks like this:
docker run -it --rm -v /home/$USER:/home/$USER -w="/home/$USER" -u $USER --hostname="$USER-gcc463-docked" precise-gcc4 tmux new -s docker-$USER
As you can see, I've used --rm so the container in theory should be removed when the user exits but, in practice, some users close their PuTTY window and the containers are left orphan.
Do you have any ideas how could I make the containers to actually be removed in this case or at least how can I find the orphan ones and clean them up?
Thank you.