Ruby equivalent of the Docker clean shell script