The --rm in the Docker client is a completely client-side option. This, for example, is why you cannot combine -d with --rm - because the client can only remove the container on exit if it remains attached to the container.
You can write a cleanup script that will periodically run docker ps -f status=exited -q and clear the result.
You can also achieve something more automated by controlling the endpoint of the Docker API /events and, I believe, will immediately respond to the container outputs.
larsks
source share