06 July 2014
As much as we would want a world in which all applications were updated regularly and licensed sanely, that is not the world we live in. Some applications cost several hundreds of thousands of dollars (per seat!) and their users expect to be able to use them into the future, even after the vendor has moved on.
One solution to let these applications run and not have to keep older OS machines on your network is Docker. Docker does have a variety of base images available through their site, however typically they are newer OSes.
If you find yourself in the sad position of making a CentOS4 base image, here are some helpful pointers:
up2dateto pull down system updates and new RPMS. However, it also supports Yum, and the CentOS4 repos do have a
repodatafolder for yum use. Grab the appropriate repodata folder, and put it in your /etc/yum.repos.d folder. Make sure to add a line for
$targetexists. What if you accidentally kill off
/tmpand then run the script and you forget to test for if
$targetexists? This exercise is left to the reader (but see #7)
yum (...) installline to include
$target/etc/yum.repos.das the the groupinstall will provide a repo that may not be what you want it to be.
rm -Rf $target/var/lib/rpm– the reason for this is that you are likely running this on a newer RHEL machine. Older versions of RPM will not be able to read the RPM database that you have created. If you really need the ability to do development and install RPMs in a docker repo to figure out what you need, after you have built a base image, run
rpm --initdband re-run your groupinstall command. Then, tar the RPM library and put it into the script so that you may experiment without having to perform this step manually. I do suggest that once you are done with dev, you just kill off the RPM library to begin with – no one should be installing RPMs inside your artisanal container, right?
There are arguments to be made for being able to use
yum in a
however, given that only one application i know of needs to be run like
this, I find that building this once and keeping the scripts in revision
control work well enough for me.
Dockerfile is fairly simple - I have a
ADD and an
ENTRYPOINT - the
ADD simply drops in an init
script that adds a local-to-container user with the appropriate uid/gid,
then switches to that user and runs the application. X11 use is handled
by proper management of the
DISPLAY variable and/or by exposing
/tmp/X11-Unix to the container.
Hopefully you find yourself not needing to support older apps. But, in the event you do, maybe this will help.