Software AG Products 10.7 | Configuring API Gateway | Docker Configuration | Building the Docker Image for an API Gateway Instance
 
Building the Docker Image for an API Gateway Instance
The API Gateway Docker image provides an API Gateway installation. Depending on the existing installation, the API Gateway Docker image provides a standard API Gateway or an advanced API Gateway instance. When running the image, the API Gateway is started. The API Gateway image is created on top of an Integration Server image.
*To build a Docker image for an API Gateway instance
1. Create a docker file for the Integration Server (IS) instance by running the following command:
./is_container.sh createDockerfile [optional arguments]
Argument
Description
-Dimage.name
Optional. Name of base image upon which the new image is built.
Default: centos:7
-Dinstance.name
Optional. IS instance name to include in the image.
Default: default
-Dport.list
Optional. Comma-separated list of the ports on the instance to expose in the image.
Default: 5555,9999
-Dpackage.list
Optional. Comma-separated list of Wm packages on the instance to include in the image.
Default: all (this includes all the Wm packages and the Default package)
-Dinclude.jdk
Optional. Whether to include the Integration Server JDK (true) or JRE (false) in the image.
Default: true
-Dfile.name
Optional. File name for the generated docker file.
Default: Dockerfile_IS
2. Build the IS Docker image using the Docker file Dockerfile_IS by running the following command:
./is_container.sh build [optional arguments]
Argument
Description
-Dfile.name
Optional. File name of the Docker file to use to build the Docker image.
Default: Dockerfile_IS
-Dimage.name
Optional. Name of the generated Docker image.
Default: is:micro
3. Create a Docker file for the API Gateway instance from the IS image is:micro by running the following command:
./apigw_container.sh createDockerfile [optional arguments]
Argument
Description
--instance.name
Optional. API Gateway instance to include in the image.
Default: default
--port.list
Comma-separated list of the ports on the instance to expose in the image.
Default: 9072
--base.image
Name of the base Integration Server image upon which this image should be built.
Default: is:micro
--file.name
Optional. File name for the generated Docker file.
Default: Dockerfile_IS_APIGW
--target.configuration
Optional. Target configuration for which Dockerfile is created.
Not specifying any value builds a Dockerfile for the Docker and Kubernetes environments.
Specifying the value OpenShift builds a Dockerfile for an OpenShift environment.
Note:
If you specify the --target.configuration option, the Integration Server image specified by the --base.image option should be available before you create the API Gateway Dockerfile. The Integration Server Docker image is analyzed with docker inspect in order to extract some information necessary for the API Gateway Dockerfile.
--os.image
Optional. Name of the base operating system image upon which this image is built if the --target.configuration is set to OpenShift.
Default: centos:7
Note:
The value of this parameter has to be aligned with the one specified for -Dimage.name in Step 1.
The Docker file is created under the packages directory of the specified Integration Server instance. In a default installation, the Docker file is created in the folder SAG_Root/IntegrationServer/instances/default/packages/Dockerfile_IS_APIGW.
4. Build the API Gateway Docker image using the core Docker file Dockerfile_IS_APIGW by running the following command:
./apigw_container.sh build [optional arguments]
Argument
Description
instance.name
Optional. API Gateway instance to include in the image.
Default: default
file.name
File name of the Docker file to use to build the Docker image.
Default: Dockerfile_IS_APIGW
image.name
Optional. Name for the generated Docker image that contains the custom packages.
Default: is:apigw
The image is stored in the local registry of the Docker host. To check the image, run the command $ docker images
Example
A sample shell script for creating an API Gateway Docker image looks as follows:
echo "is createDockerfile ======================================================="
./is_container.sh createDockerfile
status=$?

if [ $status -ne 0 ]
then
echo "Failed! status: $status"
exit $status
fi

echo "is build =================================================================="
./is_container.sh build
status=$?

if [ $status -ne 0 ]
then
echo "Failed! status: $status"
exit $status
fi

echo "apigw createDockerfile =================================================="
./apigw_container.sh createDockerfile
status=$?

if [ $status -ne 0 ]
then
echo "Failed! status: $status"
exit $status
fi

echo "apigw build ============================================================="
./apigw_container.sh build
status=$?

if [ $status -ne 0 ]
then
echo "Failed! status: $status"
exit $status
fi
After running the steps, the created images can be listed using the command docker images. The following sample result shows the base image centos:7, the Integration Server image is:micro, and the API Gateway image is:apigw.
REPOSITORY TAG IMAGEID CREATED SIZE
is apigw af29373fc98a 15 hours ago 1.3GB
is micro 06e7c0de4807 15 hours ago 1.1GB
centos 7 36540f359ca3 12 days ago 193MB
Note:
The is:micro and therefore, the is:apigw images are based on the centos:7 image, which is available from the official CentOS repository
The Docker images resulting from Docker files created using the createDockerFile command feature the following:
*Docker logging.
API Gateway Docker containers log to stdout and stderr. The API Gateway logs can be fetched with Docker logs.
*Docker health check.
API Gateway Docker containers perform health checks. You can use wget request against the API Gateway REST API to check the health status of API Gateway.
The following wget request shows a curl invocation sending a request against the HTTP port. If API Gateway exposes an HTTPS port, only the wget is created accordingly. The option --no-check-certificate is used to avoid any failure due to certificate problems.
HEALTHCHECK CMD curl --no-check-certificate
http://localhost:5555/rest/apigateway/health
The wget checks the API Gateway availability by sending requests to the API Gateway REST health resource. If the wget is successful, API Gateway is considered healthy.
*Graceful shutdown.
Docker stop issues a SIGTERM to the running API Gateway.