Test your Docker image builds on multiple Linux distributions

Test your Docker image builds on multiple Linux distributions.

Why? It seems things behave differently on different distos. Here is a situation I just ran into.

I have been working on a new Docker image for an up coming post. The post uses CentOS and I generally use CentOS on my servers so I naturally built the image on a CentOS host. Once everything was way I wanted it I committed the changes to Github and had Dockerhub pull and build the image. To my surprise the build failed with the error

Could not find 'which' command, make sure it's available first before continuing installation.

I went back to my CentOS host and built the image again.  No errors.  On a hunch, I created an Ubuntu VM to build the image. Bingo! While the image built cleanly on CentOS, under Ubuntu it would fail with the error above.

While the fix was as simple as explicitly installing the which package as part of the build process, it showed me two things.

  1. Don’t assume your images build on all Linux distributions.
  2. Don’t assume Docker behaves the same on all Linux Distributions.

Happy image building!

2 thoughts on “Test your Docker image builds on multiple Linux distributions

    1. Thank you for the comment. The point I was trying to make is, don’t assume that what works on one Linux distro will work on another. You need to test and be sure so you don’t waist your time. In my case, I always start with a minimum install and build up, so sometimes a tool you expect to be installed is missing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*