Docker and IBM Domino (part 3)

Installing Domino in Centos

The first bit of this that we need to understand is the command that we are using to do the initial install. Don’t run this yet.

docker build -t timsterc/domino:9_0_1 -f dom_on_docker/domino901/Dockerfile .

docker – well we’ve seen this already and it’s how we tell docker we want to work with it
build – this tells Docker that we want to create an image from a Dockerfile
-t timsterc/domino:9_0_1 – tag list, the name that we want to call something. I have timsterc here as that is my name in docker, so if I upload it then I can find it again.
-f Dockerfile – the name of the script file that you want to run during the build
. – Don’t miss this full stop as the command will not work without it. This is placing the file in the same place that Docker uses for everything.

You should change the ‘timsterc‘ part to your own name. Keep in mind, that if you do, you will need to edit the Dockerfiles that follow to use your name and not mine. ;o)

Now let us take a look at the Dockerfile and what that is going to do during the build. I’ve broken it up into sections to make it easier to explain.

This is “dom_on_docker/domino901/Dockerfile”

FROM centos

This command tells Docker to take all of the contents of the ‘centos’ image that we downloaded earlier and use that as a basis for what we are about to do here. Really useful for adding to an existing image to make a new one. We will use this technique later to create a new image from the base Domino image and add the FixPack to it.

ENV DOM_SCR=dom_on_docker/domino901/resources/initscripts
ENV DOM_CONF=dom_on_docker/domino901/resources/serverconfig
ENV NUI_NOTESDIR /opt/ibm/domino/

These are just environment variables that we use later in the script. An easy way to config the script file without having to trawl through each line of code.
DOM_SCR and DOM_CONF are the locations of the scripts to run Domino (thanks to Daniel Nashed for those) and the server response file for the silent install.
DOM_SRC is the local directory where you copied the Domino 9.0.1 for 64bit Linux image from Passport Advantage.
NUI_NOTESDIR defines the location you want to install Domino into in the CentOS image.

RUN yum update -y && \
    yum install -y which && \
    yum install -y nano && \
    yum install -y wget && \
    yum install -y perl && \
    useradd -ms /bin/bash notes && \
    usermod -aG notes notes && \
    usermod -d /local/notesdata notes && \
    sed -i '$d' /etc/security/limits.conf && \
    echo 'notes soft nofile 60000' >> /etc/security/limits.conf && \
    echo 'notes hard nofile 80000' >> /etc/security/limits.conf && \
    echo '# End of file' >> /etc/security/limits.conf

This next section updates CentOS to the latest updates, adds the Notes user and sets the soft and hard file limits for Domino

COPY ${DOM_CONF}/ /tmp/sw-repo/serverconfig
RUN mkdir -p /tmp/sw-repo/ && \
    cd /tmp/sw-repo/
COPY ${DOM_SRC}/DOMINO_9.0.1_64_BIT_LIN_XS_EN.tar /tmp/sw-repo/

The section above creates a temporary directory and copies over the Domino tar ball to it. The && \ concatenates the lines together and is removed at runtime. Great way of splitting up really long command lines into readable parts.

RUN cd /tmp/sw-repo && \
    tar -xf /tmp/sw-repo/DOMINO_9.0.1_64_BIT_LIN_XS_EN.tar && \
    cd /tmp/sw-repo/linux64/domino && \
    /bin/bash -c "./install -silent -options /tmp/sw-repo/serverconfig/domino901_response.dat" && \
    cd / && \
    rm /tmp/* -R

I found while messing about with this script file to use a local file and not one from a web server, that every command runs in its own environmental space. This is why we have to change the directory to our temp directory again in the next command, otherwise, the command runs with a new space and is in the wrong directory.
Next, we extract the install code inside the image, then run the Domino install with the server response while we copied in earlier. Once we are done with the install (which does look like it’s hanging while it works) we remove all the temporary files to keep the image clean and as small as possible.

RUN mkdir -p /etc/sysconfig/
COPY ${DOM_SCR}/rc_domino /etc/init.d/
RUN chmod u+x /etc/init.d/rc_domino && \
    chown root.root /etc/init.d/rc_domino
COPY ${DOM_SCR}/rc_domino_script /opt/ibm/domino/
RUN chmod u+x /opt/ibm/domino/rc_domino_script && \
    chown notes.notes /opt/ibm/domino/rc_domino_script
COPY ${DOM_SCR}/rc_domino_config_notes /etc/sysconfig/

Lastly, we set up the scripts that run Domino in the CentOS image, making sure that the Notes user can run them.

So now we understand what’s happening, go ahead and make sure you are in your docker folder and then run this command.

docker build -t timsterc/domino:9_0_1 -f dom_on_docker/domin901/Dockerfile .

Don’t forget that if you change the tag names, you’ll need to change them in the follow-on scripts. I’ll highlight these when they come up.

This can take a while and it will look like it’s hung when it gets to the Domino install bit. Don’t Panic, just have a little faith. If you have a slow machine or it goes past 30 minutes, you could have a problem. You should be fine though, it just takes a while.

Once this has run, you can try the follow Docker command to list out your images.

docker images

The results should look something like the below.

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
timsterc/domino     9_0_1               cbe3262a559d        12 days ago         2.73GB
centos              latest              49f7960eb7e4        3 weeks ago         200MB
hello-world         latest              e38bc07ac18e        2 months ago        1.85kB

Next time we will follow a similar procedure to install FixPack 10.

Buy me a coffeeBuy me a coffee