Skip to content

Docker image from IBM DataPower .deb or .rpm

ibm-om edited this page Jun 16, 2016 · 12 revisions

To create a Docker image from the IBM DataPower® Gateway .deb or .rpm file, you must have the Debian or RPM installation package, available from IBM Passport Advantage (PPA). For an Ubuntu Docker container, use Debian installation package files. For an RHEL Docker container, use RPM installation package files.

Considerations

When built from the .deb or .rpm image, each DataPower® Gateway requires the --privileged Docker run flag. Privilege escalation is necessary to access the host system's loop mount devices. Loop mount devices provide the basis for maintaining DataPower® Gateway file systems.

The Datapower Gateway enables external access to the local: directory (used for configuration artifacts such as stylesheet and DataPower® Gateway files) and config: directory (for configuration files).

  • You can use any DataPower management interface to save changes externally.
  • You can enforce version control on file changes that are reflected in the DataPower® Gateway.
    External access is configured by adjusting entries in the Dockerfile, or directly editing the /opt/ibm/datapower/datapower.conf file.
    More information regarding the datapower.conf file is available in this wiki here, and at the IBM DataPower Gateway Knowledge Center.

Prerequisites

  • The operating system is running Docker engine 1.8, or 1.9.
  • The schroot package must be installed.
    • In RHEL, it is available from Fedora EPEL.
    • In Ubuntu, it is available in the main repository.
  • At least two free loop devices are required, with one additional loop device if RAID storage is used.
  • 5 GB of free storage must be available for the initial DataPower® Gateway Docker image.

Note: Overall, 100 GB of available storage is sufficient for development until you determine how to organize DataPower® Gateway images for distribution to a wider audience.

Docker commands

A Docker container that is made from the DataPower® Gateway image is controlled with normal Docker commands and not with initctl or systemctl.
The Docker container can safely stop only after the DataPower® Gateway releases all connections to host resources. The time required to release resources varies by host.

When the docker stop command is entered with an adequate timeout, the DataPower® Gateway stops gracefully and brings the container to a status of Exited. If you use docker stop without an adequate timeout, Docker cannot remove the container or loop devices, which must be recovered manually or with a reboot of the host system. Use the -t option to provide the DataPower® Gateway time to release its resources.
This example causes Docker to wait 300 seconds after it sends SIGTERM to the container PID before it sends SIGKILL to any still active processes.

 'docker stop -t 300 _container_name_`

Installing the Debian or RPM package on Docker

Installing DataPower® Gateway inside Docker is similar to installing in RHEL or Ubuntu. However, there are two differences when you install inside Docker. After installing the Debian or RPM package, you must run the /opt/ibm/datapower/datapower-docker-build.sh script. Use the /opt/ibm/datapower/datapower-launch program to start the DataPower Gateway instead of the system init. Both of these are achieved with the sample Dockerfile provided here.

The following method is one approach to install the DataPower® Gateway in a Docker image with a sample Dockerfile.

Before you begin

  • Obtain the DataPower Gateway package from IBM® Passport Advantage® (PPA) that corresponds to the version of Linux you run in your container.
  • Make sure that you understand Docker concepts and terminology.
  • Create a directory for this work such as ~/datapower-docker/
  • Place the Debian or RPM package files and a Dockerfile in the directory you created.
  • Change the Debian or RPM package file names, or edit the Dockerfile to ensure that the entry matches the package file names.

About this task
Use a Dockerfile to build a DataPower Gateway Docker image from the Debian or RPM package that you obtain from PPA. You can then create the DataPower Gateway Docker container instances from the Docker image. When you intend to use a file-based block device for RAID, set the DataPowerRaidDevice directive in the Dockerfile or in the opt/ibm/datapower/datapower.conf file.

Procedure

  1. Build the image when you enter the docker build command. Notice that the trailing period is part of the command.
    docker build -t ibm-datapower-factory .
    An image is created that is listed when you enter the docker images command.

  2. Create a Docker container with the name datapower, run with elevated privileges, map host port 9090 to Docker container port 9090, when you enter the docker run command.
    docker run -d --name datapower --privileged -p 9090:9090 ibm-datapower-factory
    After approximately 5 minutes, DataPower GUI is available on port 9090 on the Docker host, and Telnet is available on port 2200 inside the container.

  3. Prepare to initialize the DataPower® Gateway when you enter the Docker docker exec command.
    docker exec -it datapower telnet 127.0.0.1 2200

What to do next: Initialize the DataPower Gateway, then accept the license agreement.

Clone this wiki locally