Creating a DataPower Docker application
To build your DataPower® Docker image, you must develop the application’s configuration. The easiest method is in the Docker containers on your workstation.
Before you begin
Before you can build and deploy a DataPower Docker application you must create an export package that contains the DataPower configuration for the DataPower Docker image. You create and export the DataPower configuration on a DataPower appliance or virtual DataPower offering.
You can create the DataPower configuration using the DataPower GUI, CLI, or other management interface, which can be importing an existing export package from a secure server and using a deployment policy with deployment policy variables to modify the configuration in the export package during import. The resultant and exported configuration should be the explicit configuration for your DataPower Docker application.
The defined and imported configuration is restricted to features supported by DataPower for Docker. If you create an export package from another DataPower offering with features not supported by DataPower Gateway for Docker, these feature will be unavailable. For more information, see Managing add-on features for a DataPower Docker image.
The easiest way to export and import packages is through the DataPower GUI, but you can use the DataPower backup command to do an export.
- Download the version-specific DataPower firmware image from the read-only IBM Container Registry, which is also known as the IBM Container Software Library.
- Create a clean working directory with the config, local, and certs subdirectories. These subdirectories will be mounted inside the container to extract the application’s configuration. For more information, see Directories in a DataPower Docker image.
- Grant full permission to ensure that everyone can access these subdirectories.
chmod -R 777 config local certs
- Start the container. The following snippet is the minimum required set of parameters. For
more information, see Environment variables and drouter arguments and a DataPower Docker image.
docker run -it –-name name \ -v $(pwd)/config:/opt/ibm/datapower/drouter/config \ -v $(pwd)/local:/opt/ibm/datapower/drouter/local \ -v $(pwd)/certs:/opt/ibm/datapower/root/secure/usrcerts \ -e DATAPOWER_ACCEPT_LICENSE="true" \ -e DATAPOWER_INTERACTIVE="true" \ -p 9090:9090 \ tag
nameis the name of the container, and
tagis generally in the
- Configure access to the DataPower GUI.
# configure terminal # web-mgmt # admin-state "enabled" # exit
- Access the DataPower Gateway to import the
export package that contains your DataPower configuration.
- To start a GUI session, enter https://localhost:9090 as the URL in your browser.
- To start a CLI session, use the docker attach command.
- After you write and test your configuration, save everything to your mounted
- In the GUI, click Save Configuration.
- In the CLI, issue the write memory command.
- Stop the DataPower container, where name is the name of the
docker stop -t 300 name
- Change ownership of files owned by root.
chown -R $USER:$USER config local certs
- Create the Dockerfile for the DataPower Docker image. The following snippet is the most
basic Dockerfile that you should require.
FROM tag COPY config /opt/ibm/datapower/drouter/config COPY local /opt/ibm/datapower/drouter/local COPY certs /opt/ibm/datapower/root/secure/usrcerts USER root RUN chown -R drouter:root /opt/ibm/datapower/drouter/config \ /opt/ibm/datapower/drouter/local \ /opt/ibm/datapower/root/secure/usrcerts RUN set-user drouter USER drouter
- With your Dockerfile, build your DataPower Docker image, where
my-image is the name that differentiates various DataPower Docker images in your
docker build . -f Dockerfile -t my-image
- Use the docker push command to upload the DataPower Docker image to your repository.