Last updated 8 months ago
By default, Docker doesn't remove containers when they exit, this can lead storage getting full. To remove a container as soon as it exits, we can pass --rm argument in docker run command.
--rm
docker run
$ docker run --rm ubuntu echo "Hello Docker"
Source: