Docker --rm flag
Today I knew smt new: By default a container’s file system persists even after
the container exits. This makes debugging a lot easier (since you can inspect
the final state) and you retain all your data by default. But if you are running
short-term foreground process, these container file system can really pile up.
If instead you’d like Docker to automatically clean up the container and remove
the fiel system when the container exits, you can add the --rm
flag.
Ex:
docker run --rm image-name args