IBM Integration Bus, Version 10.0.0.17 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


Building a sample IBM Integration Bus and IBM MQ Server image using Docker

You can build a sample IBM® Integration Bus and IBM MQ Server image, using Docker.

Before you begin

Read the following topics:

About this task

IBM Integration Bus and IBM MQ maintain the following GitHub repositories of artefacts, which you can use to build and run Docker images:

You can use the Dockerfiles and supporting scripts to get started with combining IBM integration and messaging technology with Docker, or you can customize them and incorporate them into more complex develop, test, and deploy scenarios.

If you want to run IBM Integration Bus with a default queue manager (through a local MQ server bindings connection), both IBM Integration Bus and IBM MQ must run in the same container. To achieve this, you can create an image that contains installations of both products.

You can use the FROM instruction to take advantage of the layering capability in Docker images; for example, an IBM Integration Bus image can be built on top of an IBM MQ image, making the MQ installation available in the IBM Integration Bus environment. For example, if you have an image tagged mq:8006, which contains a deployment of IBM MQ, you can start the Dockerfile of your IBM Integration Bus image by issuing the following command:
FROM mq:8006

The IBM Integration Bus and MQ Dockerfiles published on GitHub each download Developer Editions of the respective products via HTTP. However, you can also run your own licensed editions by obtaining the installation images from a local repository, through a secure protocol such as SSH, for example. You can choose to copy the installation binaries from the local filesystem to the image (by using the COPY instruction), but this is not advisable because doing so can result in large images containing files that you no longer need but cannot easily remove. This situation can occur because the COPY instruction in a Dockerfile creates a new filesystem layer, and subsequent attempts to remove the file that was copied can hide it without releasing the occupied space.

For more information, see IBM Integration Bus and Docker: Tips and Tricks.

Procedure

Follow these steps to install and configure your licensed versions of IBM Integration Bus and IBM MQ:

  1. Run a full installation, including the initial SSH fetch and the subsequent deletion of the installation archive, in a single RUN instruction, as shown in the following example:
    COPY *.sh *.mqsc id.rsa host.key /tmp/
    RUN ["/bin/bash", "/tmp/install.sh"]
    The COPY instruction copies all Shell scripts, MQSC scripts, and SSH credentials to the image, which allows the install.sh script to make an SSH connection to the Docker host and fetch an IBM MQ installation image:
    # find the IP address of the Docker host
    HOSTIP=`ip route show 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print \$2 }'`
    # ...
    # set up SSH access for root
    mkdir -m 700 ~/.ssh
    cat /tmp/host.key | sed s/localhost/${HOSTIP}/ >> ~/.ssh/known_hosts
    mv /tmp/id.rsa ~/.ssh/id_rsa
    chmod 644 ~/.ssh/known_hosts
    chmod 600 ~/.ssh/id_rsa
    rm -rf /tmp/host.key
    # ...
    # fetch and extract MQ install image
    mkdir /tmp/mq
    cd /tmp/mq
    scp ${SSHUSER}@${HOSTIP}:${MQIMAGEPATH}/${MQIMAGE} .
    tar -xzvf ${MQIMAGE}
    Note: Ensure that the SSHUSER, MQIMAGEPATH, and MQIMAGE environment variables have been set before you run the code snippet.
  2. Configure the installed products. One of the steps in the MQ Dockerfile enables the automatic configuration of the queue manager that is created in the container. The management script that is provided with the official MQ Dockerfile contains the following snippet, which is executed immediately after the newly created queue manager is started:
    # Turn off script failing here because of listeners failing the script
    set +e
    for MQSC_FILE in $(ls -v /etc/mqm/*.mqsc); do
      runmqsc ${MQ_QMGR_NAME} < ${MQSC_FILE}
    done
    set -e

    This code causes all .mqsc scripts that have been copied over from the Docker host to be run on the new queue manager. You can also add a command to the iib_manage.sh script (which is shipped with the Dockerfile for IBM Integration Bus) to call a user configuration script after starting the new integration node. Alternatively, you might choose to move the whole setup procedure to a separate initialization script.

    You can also run administrative commands manually, on either IBM MQ or IBM Integration Bus, as shown in the following example:
    docker exec -ti myNode /bin/bash -c dspmq
    docker exec -ti myNode /bin/bash -c mqsilist

bz91350_.htm | Last updated 2019-07-13 08:14:09