Running Microgateway 10.5 in a Windows Container

Introduction

The Microgateway 10.5 scripting does not support the creation of Docker files for building Docker images running as Windows containers. This tutorial describes how to run Microgateway 10.5 in a Windows Container by applying a simple custom Dockerfile.

Set up the Docker Environment

Setting up your Windows environment requires the following steps:

  • Install DockerDesktop
  • Switch DockerDesktop to Windows Containers

Further details can be obtained from the Docker and Windows documentation.

Create the Docker Image

The first step for creating the Docker image is to pull the base Windows nano image that matches your Windows hosts:

> docker pull mcr.microsoft.com/windows/nanoserver:1809

Make sure that your Windows image version matches the kernel version of your Windows machine.

After that a Microgateway instance has to be created from the Windows Microgateway intallation:

> microgateway.bat createInstance --instance "C:\Users\user\Work\API Microgateway\Windows\Microgateway.zip"

The --instance parameter needs to point to a file outside your Microgateway installation.  Then, move to your directory "C:\Users\user\Work\API Microgateway\Windows" and unzip Microgateway.zip:  The unzip should create a Microgateway directory within C:\Users\user\Work\API Microgateway\Windows. 

Add the following Dockerfile to the directory "C:\Users\user\Work\API Microgateway\Windows":

FROM mcr.microsoft.com/windows/nanoserver:1809 
COPY Microgateway c:\\Microgateway 
WORKDIR c:\\Microgateway 
CMD ["microgateway-jre-win\\bin\\java", "-jar", "microgateway-server.jar", "start", "-p", "9090"]

With the Dockerfile the image can be built by executing the following command in the directory "C:\Users\user\Work\API Microgateway\Windows":

> docker build -t mcgw-windows .

The docker images command should show the resulting image: 

> docker images

REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
mcgw-windows                           latest              cfe1e568754a        2 days ago          338MB
Microsoft Artifact Registry   1809                96b4b0f16026        2 weeks ago         251MB

Run Empty Microgateway Container

To verfiy that the image creation has worked according to plan, start a Microgateway Docker container without any APIs:

> docker run -d -p 9090:9090 -name microgateway mcgw-windows:latest

The state of the running container can be checked with docker ps:

> docker ps

REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
mcgw-windows                           latest              cfe1e568754a        2 days ago          338MB
Microsoft Artifact Registry   1809                96b4b0f16026        2 weeks ago         251MB

The Microgateway state itself can be checked via the following curl command: 

{
    “description”: “webMethods Microgateway”,
    “publisher”: “Software AG”,
    “version”: “10.5.0.5.189”
}

The empty Microgateway container can be stopped and removed via docker rm:

> docker rm -f microgateway

Provisioning of APIs

Let's assume an API Gateway is running on sample-host and holds the API EmployeeService. A Microgateway pulling the EmployeeService from the API Gateway can be started as follows: 

> docker run -p 9090:4485 --env mcgw_api_gateway_url=http://sample-host:5555/rest/apigateway --env mcgw_api_gateway_user=Administrator --env mcgw_api_gateway_password=manage --env mcgw_downloads_apis=EmployeeService --name microgateway mcgw-windows

Once the Microgateway Windows container is up and running the following curl command shows the deployed API.  

{
    “apis”: [{
        “apiName”: “EmployeeService”,
        “apiVersion”: “1”,
        “type”: “REST”,
        “systemVersion”: 1,
        “id”: “85d4683b-84f6-42d7-89cb-e909c4d9a245”,
        “httpEndpoint”: “http://301ad9842cbe:9090/gateway/EmployeeService/1”,
        “httpsEndpoint”: “”,
        “scopes”: ,
        “policyActions”: [
            {
                “name”: “Enable HTTP / HTTPS”,
                “stageKey”: “transport”,
                “id”: “72a4c3d9-29f7-4b4a-9088-f442e6170496”,
                “global”: “false”,
                “description”: “”,
                “protocol”: [“http”]
            },
            {
                “name”: “Straight Through Routing”,
                “stageKey”: “routing”,
                “id”: “3c9899d4-d4d4-454d-a64b-e1bf8f9eab6e”,
                “global”: “false”,
                “description”: “”,
                “endpointUri”: [“http://sample-host:19084/EmployeeService/${sys:resource_path}”]
            },
            {
                “name”: "Default Callback URL Replacer Action for API ",
                “id”: “callbackURLReplacer”,
                “global”: “false”
            }
        ]
    }],
    “applications”: ,
    “policies”: ,
    “aliases”: ,
    “authserver”: 
}

The Microgateway Windows container is now running and ready to serve API requests.

Dockerfile (210 Bytes)