Useful Dockerfiles for the RHEL-ecosystem
Like most programmers, I find it much easier to take some existing example of code and modify it to do what I want. Sometimes, I end up with nothing from the original source, but I still find it easier. I wonder if this is akin to writing where, I find, if you put the words down in a stream of consciousness manner, then “rewrite, rewrite, rewrite.”
As such, I am really excited about the efforts from the CentOS, Fedora, and Red Hat communities in providing Dockerfiles and docker images. As you probably realize, the docker images should just work between the various host platforms. However, what may not be as obvious is that the Dockerfiles themselves are also pretty cross-platform because the package names, how you “make things go” and the like are pretty similar between the different variants of the distros.
As a result, you can use the Dockerfiles as starting points for your projects or as a starting point for creating new Dockerfiles in one of the other distros. For example, if you want to base an owncloud installation on CentOS but all you know about is the Fedora Dockerfile as Adam Miller shows in this CentOS variant.
Many of the Dockerfiles have also been built as images and placed in to the registry at Docker Hub. With these semi-official images readily available, you can also quickly try out a piece of software that you don’t want to fully install on your own. You can also base your work on these images and shorten your build cycles (and be certain that more of your base is “known good”).
Software Collections, which you know we write about here a lot, are also a topic of interest inside a Dockerfile bringing some unique challenges because of the need to run a command (e.g. scl enable mariadb55 …) before executing the application. Luckily both the CentOS and the Red Hat communities have provided Dockerfiles that you might find useful.
I hope you found this handy. Let us know in the comments what else you would find useful, or donate your Dockerfile to the appropriate repository.
Where to find ’em:
* RHSCL Dockerfiles: http://www.github.com/sclorg
* Fedora Dockerfiles: https://github.com/fedora-cloud/Fedora-Dockerfiles; Images at: https://registry.hub.docker.com/repos/fedora/
* CentOS Dockerfiles: https://github.com/CentOS/CentOS-Dockerfiles; Images at: https://registry.hub.docker.com/repos/centos/
Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.