Building a sample base IBM MQ queue manager image
In order to use IBM MQ in Docker, you need initially to build a base image with a clean IBM MQ installation. The following steps show you how to build a sample base image, using code hosted on GitHub.
- Use Make to build the Docker image
- If you wish to use the make files supplied in the mq-container GitHub repository to build your production Docker image, follow the instructions in Building a Docker image in GitHub.
- Building the Docker image manually using docker
- If you wish the build the image manually using docker, complete the following steps.
Procedure
-
Install the prerequisite packages.
These instructions make use of some Linux
packages that you must install.
- On Ubuntu:
sudo apt-get install python git
- On Red Hat Enterprise Linux:
sudo yum install python git
- On Ubuntu:
- Create a downloads directory by issuing the command mkdir downloads.
-
Download the IBM MQ server for
Linux image, using Passport Advantage®.
See Installation using Electronic Software Download for more details.
For example, select the WS_MQ_V9.0.5.0_LINUX_ON_X86_64_IM.tar.gz file, and place the file in the downloads directory that we have created.
Note: You must ensure that we download the Debian installation if you plan to use Ubuntu as your base image.
-
Make the IBM MQ server for Linux image (tar.gz) file available on
an HTTP or FTP server.
The reason for this is to save space in the Docker image layers. Every instruction in a Docker file causes a new image layer to be created.
If we use the ADD or COPY instructions, followed by a RUN instruction to install, then the files added or copied will be committed to a new image layer.
Even if you delete the file in subsequent layers, the file still exists in the previous layer. For this reason, it is good practice to download and install within a single RUN command, which means the files need to be available on the network.
For example, we can use Python to run an HTTP server, serving all files in your current directory:pushd downloads nohup python -m SimpleHTTPServer 8000 & popd
-
Extract the sample files, for building a supported Docker image, from GitHub:
Issue the following command:
git clone -b mq-9-lts https://github.com/ibm-messaging/mq-docker mq-docker
Issue the following command:
git clone https://github.com/ibm-messaging/mq-container mq-container
-
Identify your local IP address.
Your address is specific to your local environment, but should be available if you run the following command:
ip addr show
Note that localhost does not work.
-
Build the base IBM MQ image by issuing the
following command, replacing the IP address and file name in the MQ_URL for the values that we have
just identified:
For example:
sudo docker build --tag mq --build-arg MQ_URL=http://10.0.2.15:8000/WS_MQ_V9.0.0.0_LINUX_ON_X86_64_IM.tar.gz mq-docker
sudo docker build --tag mq --build-arg MQ_URL=http://10.0.2.15:8000/WS_MQ_V9.0.0.0_LINUX_ON_X86_64_IM.tar.gz mq-container/Dockerfile-server mq-container
Results
You now have a base Docker image with IBM MQ installed.