28 July 2016
Today I wanted to check how much diskspace I wasted in my home directory. On windows I’d use WinDirStat and on linux there is the alternative qdirstat. Unfortunately there is no pre-build binary for my distribution, so I decided to build from source. But I don’t want litter my system with Qt dependencies, so I decided to build it in a docker container. Here’s my Dockerfile:
First you have to create an image from this Dockerfile:
# copy the Dockerfile into a new directory and run the following command in a terminal in that directory docker build -t moritanosuke/qdirstat .
Now you can start a container from this image to clone and build qdirstat:
# run the container docker run --rm -it -v $(pwd):/usr/target moritanosuke/qdirstat
Now you should have the executable in the current directory. The owner will be root, but you should be able to run it on your local machine now - assuming that you have all dependencies to run Qt applications already installed. The container was removed right after it completed the build, so the only thing left to do is removing the image:
docker rmi moritanosuke/qdirstat
This is now my preferred way to build random open source projects without messing up my local machine. In earlier times I used full blown VMs with snapshots, but this is even faster.