You can build a sample IBM® Integration Bus Docker image.
About this task
To run IBM Integration Bus in a Docker container, you must first build a base image containing an installation of IBM Integration Bus, by following the steps described in this topic. You can, alternatively, download an image of the IBM Integration Bus for Developers edition from https://hub.docker.com/r/ibmcom/iib/ and run this in a Docker container.
A Dockerfile is a set of
instructions for building a Docker image. Images can be stored in
local or remote registries, and are used to create a running Docker
container. To build the image, Docker executes the instructions in
the Dockerfile. Each instruction causes a new image layer to be created.
Docker best practice guidelines recommend that you keep the number
of Dockerfile instructions to a minimum, because the number of layers
in an image might be limited. The guidelines, which are available
at https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices, suggest that you “find
the balance between readability (and thus long-term maintainability)
of the Dockerfile and minimizing the number of layers it uses. Be
strategic and cautious about the number of layers you use.”
The FROM
instruction
takes advantage of the layering capability in Docker images; for example,
an IBM Integration Bus image could be built
on top of an Ubuntu image. You could also build IBM Integration Bus images that build on top of
images containing IBM MQ.
The following GitHub repository contains
a Dockerfile and some scripts that show one way in which you can build
an IBM Integration Bus Docker image: https://github.com/ot4i/iib-docker.
Procedure
The following steps show how to build a sample base image,
using scripts that are hosted on GitHub:
- Build the image using standard Docker commands against
the supplied Dockerfile.
For example:
cd 10.0.0.9
docker build -t iibv10image .
This command
creates an image called
iibv10image, which occupies
approximately 1.15GB of space (including the size of the underlying
Ubuntu base image) in your local Docker registry, as shown in the
following example:
REPOSITORY TAG IMAGE ID CREATED SIZE
iibv10image latest b8403ecfcd0d 2 seconds ago 1.15GB
ubuntu 14.04 132b7427a3b4 3 weeks ago 188MB
The
built image contains a full installation of IBM Integration Bus for Developers at the latest fix pack level.
- After building a Docker image from the supplied files,
you can run a container that will create and start an integration
node, to which you can deploy integration solutions. To run a container
from this image, complete the following steps:
- Accept the terms of the IBM Integration Bus for Developers license, by specifying the
environment variable
LICENSE
equal to accept
when
running the image. You can also view the license terms
by setting this variable to view
. Failure to set
the variable will result in the termination of the container with
a usage statement. You can view the license in a different language
by setting the LANG
environment variable.
- Optional: In addition to accepting the license,
you can specify an integration node name using the
NODENAME
environment
variable.
- Configure the ports for integration node administration
and integration server HTTP traffic.
By default, the Dockerfile
exposes port
4414
for integration node administration,
and port
7800
for integration server HTTP traffic.
This means that you can run with the
-P
flag to auto-map
these ports to ports on your host. Alternatively, you can use
-p
to
expose and map any ports of your choice.
For example, the following
command runs a container that creates and starts an integration node
called MYNODE, and exposes ports 4414 and 7800 on random ports on
the host machine:
docker run --name myNode -e LICENSE=accept -e NODENAME=MYNODE -P iibv10image
You
can now use the following command to see which ports have been mapped,
and then connect to the web user interface for the integration node
in the usual way:
docker port <container name>
- You can now run IBM Integration Bus administration
commands by using either of the following methods:
- Run the commands directly in a container, by attaching a Bash
session to your container and executing your commands in the usual
way:
docker exec -it <container name> /bin/bash
At
this point you will be in a shell inside the container and can source mqsiprofile
and
run your commands.
- Use Docker exec to run a non-interactive Bash session that
runs any of the IBM Integration Bus commands.
For example:
docker exec <container name> /bin/bash -c mqsilist
- Optional: This image also configures syslog,
so, when you run a container, your node will output messages to /var/log/syslog,
inside the container. You can access this by attaching a Bash session
(as described above) or by using the docker exec.
For
example:
docker exec <container name> tail -f /var/log/syslog
- Verify that your container is running correctly, by completing
the following steps:
- Run the container, ensuring that you expose port 4414
to the host.
- Run the mqsilist command
to display the status of your integration node, and check that it
is listed as running.
- Access the syslog and check that there are no errors.
- Connect a browser to your host on the port that you
exposed in step 1. The IBM Integration Bus web
user interface is displayed.