Docker and IBM Domino (part 5)

Setting up Domino to run for the first time

Now we have Domino 9.0.1 with FP 10 installed, it's about time we ran the server for the first time and put it in listen mode. We can then connect to it with Remote Server Setup to finish off the installation.

docker build -t timsterc/domino:domino_9_0_1_FP_10 -f dom_on_docker/setup_domino/Dockerfile .

The Dockerfile this time is slightly different to the ones before, so lets go through it to make sure we understand what's going on.

FROM timsterc/domino:9_0_1_FP_10

Here we go again from the latest FixPack 10 image. Hopefully you are getting the idea now, that this is giving us lots of flexibility.

ENV DOM_CONF=dom_on_docker/setup_domino

Environment variable to define where our setup files are.

EXPOSE 25 80 443 1352

This line opens up the tcp ports 25 (smtp), 80 (http), 443 (https) & 1352 (nrpc). Normally here, as this server is not configured yet, you might expect us to open up port 8585 for when we open the server in listen mode. To stop having another port open at run time and minimize the config files we are going to make this 1352 in the docker-entrypoint.sh. See later in this blog post for that.

COPY ${DOM_CONF}/resources/docker-entrypoint.sh /
RUN chmod 775 /docker-entrypoint.sh
USER notes
WORKDIR /local/notesdata
ENV LOGNAME=notes
ENV PATH=$PATH:/opt/ibm/domino/

Here we copy in a bash script file 'docker-entrypoint.sh' that is used each time we start the image. We will cover that later.

NTRYPOINT ["/docker-entrypoint.sh"]

The ENTRYPOINT command tells Docker what to run at startup. E.g. where to start.

docker-entrypoint.sh

#!/bin/bash
serverID=/local/notesdata/server.id
if [ ! -f "$serverID" ]; then
    /opt/ibm/domino/bin/server -listen 1352
else
    /opt/ibm/domino/rc_domino_script start
    /bin/bash
fi

This is the batch file with the magic dust in it. (joking)

First we set the environment variable for where the server.id 'should' be. If it's not there we start the server in listen mode otherwise we start it normally.

So let's try this out.

STOP!!!! We don't have a data directory that will stay when we stop the image. Docker by default is not persistent, so we need to create somewhere for the domino date to live. Docker does allow you to attach a virtual disk to the image, so lets create that now.

docker volume create –name=domino_data

Now that we have the disk image, lets stick the keys in the ignition and fire this thing up.

docker run -it -p 1352:1352 -p 8888:80 -p 8443:443 –name 901FP10 -v domino_data:/local/notesdata timsterc/domino:domino_9_0_1_FP_10

Now we are creating a runtime 'container' from an 'image'.

Want to know what you just typed in? I thought so, and here comes the breakdown.

-i keeps the STDIN open even if you are not connected to the container. Think of it like 'headless mode'.
-t "allocates a pseudo TTY" according to the Docker run reference. The TTY is expected by most programs and by Domino. This also means that we can't redirect the output via a pipe, as the -t is not allowed in that scenario.
-p allocates a tcp port to the image. As you can see, it's possible to create a redirect at this point, from incoming port 8888 to internal port 80
-name is kinda obvious, but note that the container name doesn't have to be the same as the image it's created from
-v this is the data volume we created being attached. Syntax = volumename:mountpoint
imagename is the last option we specify here, e.g. what we are creating our container from

There is another option that you might want to consider here,

--hostname [hostname] will allow you to force the hostname in your container, as it's not specified in the image it gets a runtime hostname. Not so clever if you want to actually connect to your container from anywhere else.

When that's running you can now launch the Domino Remote Server Setup and connect it to the ip address of the Docker image. Ah, hang on, we have not set the ip address, so how do we know what it's going to be? I'm glad you asked as this took me a while to get my head around. It actually bridges to the ip address of the host machine. So what ever that is set to, is how you connect to it.

Good luck.

Before we leave this, you'll need just a couple more bits of information.

From the command line you can connect to your running image using this command

docker attach [imagename]

You can also start and stop the image using the same format but replacing the 'attach' option.

One last thing you need to know is that starting and stopping a container will not restart the OS and therefore not restart your Domino server. For that you either need to attach and issue a 'sudo init 6' to restart the OS or use '/opt/ibm/domino/rc_domino_script restart' to reboot the Domino server. You could always the Domino server from the console or Remote Console if you wish.

*** Update *** Please see Renaud's comments below about "Graceful Shutdown".

And with that, I wish you good luck in your adventures with IBM Domino on Docker.

Buy me a coffeeBuy me a coffee