Automatically Remove Long-Running Docker Containers
The following can be used in cron or run with & at the end of the command:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PID=$(docker run -d "$@") | |
docker wait $PID | |
docker rm $PID |
I found this didn’t work: http://www.ahtik.com/blog/removing-detached-docker-containers-automatically/