I was doing some research on buildah recently and decided to try to play around with a simple speedtest app we had on hand. This app is a fork of this repository on GitHub and does exactly what you would expect. So, since we already had a Dockerfile defined for the app I decided to utilize the bud capability within buildah to build using dockerfile (bud).

buildah bud -f Dockerfile -t test .

I didn’t have to specify -f Dockerfile because the bud capability defaults to Dockerfile but whatever. Once the image was build from the Dockerfile and tagged with the “test” label I was ready to grab a reference to the container and execute my python command.

test_var=$(buildah from test)

Now that test_var has my reference, I can tell buildah to run it with whatever command I would like.

buildah run $test_var python -m flask run --host=0.0.0.0 --port=5000

Bingo. Speedtest is now running and I can hit the site at localhost:5000. I did notice though that a call to buildah images as compared to docker images reveals that the buildah generated image is slightly larger than the one generated using the docker build command. Hmmm…interesting…