Automatically Remove Long-Running Docker Containers
The following can be used in cron or run with & at the end of the command:
PID=$(docker run -d "$@")
docker wait $PID
docker rm $PID
(gist)
I found this didn’t work: ahtik.com: removing detached Docker containers automatically