Docker and CentOS4
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:
- CentOS4 used
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
- You will find the script here
to be of particular value. I cut out the
- Add in a test to make sure
$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)
- You will need to modify the first
yum (...) installline to include
- Need extra packages? Make sure to copy in your repo definition from
$target/etc/yum.repos.das the the groupinstall will provide a repo that may not be what you want it to be.
- You will likely need to add in some important .i386/.i686 RPMs, especially if you are running the build script on a RHEL6 machine. Some good ones to include include libgcc and glibc.
- Kill off the RPM repository.1
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?
- Since you know your OS name, it may be beneficial to just set
- Bam. You have a CentOS4 image now!
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.
2014-07-06 16:00 +0000