The official QGIS docker image requires that much space because it includes the complete source code, all the dependencies required to build QGIS (which are at least a couple of GB's heavy) and also build components such as the QGIS server.
You likely don't need anything of the aforementioned to run a few python scripts.
There are smaller images available on dockerhub for example by opengis.ch which basically only includes the final installed software and therefore is much more lightweight (dockerhub, github). This image seems to be 2GB in size uncompressed.