B.2 Run MicroTx Distributed Transactions in a Docker Container on Windows

Use the following commands to run MicroTx Distributed Transactions in an independent Docker container on Windows operating system. These commands have been tested on PowerShell.

Before you begin, ensure that you have loaded the MicroTx Distributed Transactions Docker image and updated the tcs.yaml file. The tcs.yaml file is located in the installation_directory/MicroTx-RELEASE/deployment-descriptors/docker-compose/config folder on your local machine. This file contains the deployment configuration details for MicroTx Distributed Transactions. The coordinator image is located in the installation_directory/MicroTx-RELEASE/coordinator/container-images folder on your local machine.

Run MicroTx Distributed Transactions using the configuration details provided in the tcs.yaml file. Ensure that the tcs.yaml file is present in the current working directory.

  1. Use the following command to run MicroTx Distributed Transactions in a Docker container if you have not set up a data store and want to use internal memory.

    Sample Command

    docker container run --name otmm -v "$(pwd)":/app/config \
    -w /app -p 9000:9000/tcp --env CONFIG_FILE=/app/config/tcs.yaml \
    --network=host -d tmm:<version>

    Where,

    • --name otmm is the name of the container that you want to create.
    • -v "$(pwd)":/app/config mounts the current directory into container at the /app/config path.
    • -w /app specifies the working directory as /app. In this sample command, /app remains the default working directory as the volume is also mounted on this directory based on the value provided for the -v flag.
    • --env CONFIG_FILE=config/tcs.yaml specifies the location of the tcs.yaml file, which contains coordinator configuration.
    • --network=host or --add-host host.docker.internal:host-gateway. Based on your requirements, select a network configuration.
      • If you specify --network=host, the callback URL is host.docker.internal.
      • If you specify --add-host host.docker.internal:host-gateway, the callback URL is an IPv4 address. To retrieve the IPv4 address, run the ipconfig command and then note down the value of IPv4 Address.
    • tmm:<version> is the MicroTx Distributed Transactions Docker image that you have loaded to the local Docker repository.
  2. Use the following commands to run MicroTx Distributed Transactions in a Docker container when you want to use Oracle Database as a data store to persist the transaction state and to store the transaction logs.
    1. Create a copy of the tcs.yaml file and name it as tcs-db.yaml.
    2. Open the tcs-db.yaml file in any code editor. Under tmmConfiguration.storage, specify the type as db, and then provide details to connect to an Oracle Database under tmmConfiguration.storage.db. See Data Store Properties.
    3. Store the credentials to access Oracle Database in an environment variable, STORAGE_DB_CREDENTIAL, as shown in the following example. Provide values based on your environment. You'll use this environment variable in the next step.
      $env:STORAGE_DB_CREDENTIAL='{\"password\":\"<dbUserpassword>\", \"username\":\"<DBuserName>\"}'
    4. Use the following command to run MicroTx Distributed Transactions in a Docker container while providing credentials to access Oracle Database.

      Sample Command

      docker container run --name otmm -v "$(pwd)":/app/config \
      -w /app -p 9000:9000/tcp --env CONFIG_FILE=/app/config/tcs-db.yaml \
      --network=host \
      -env STORAGE_DB_CREDENTIAL="$($env:STORAGE_DB_CREDENTIAL)" \
      -d tmm:23.4.2

      Where,

      • --name otmm is the name of the container that you want to create.
      • -v "$(pwd)":/app/config mounts the current directory into container at the /app/config path.
      • -w /app specifies the working directory as /app. In this sample command, /app remains the default working directory as the volume is also mounted on this directory based on the value provided for the -v flag.
      • --env CONFIG_FILE=config/tcs-db.yaml specifies the location of the tcs-db.yaml file, which contains coordinator configuration and credentials to connect to an Oracle Database.
      • --network=host or --add-host host.docker.internal:host-gateway. Based on your requirements, select a network configuration.
        • If you specify --network=host, the callback URL is host.docker.internal.
        • If you specify --add-host host.docker.internal:host-gateway, the callback URL is an IPv4 address. To retrieve the IPv4 address, run the ipconfig command and then note down the value of IPv4 Address.
      • tmm:<version> is the MicroTx Distributed Transactions Docker image that you have loaded to the local Docker repository.
  3. After MicroTx Distributed Transactions is installed, run the MicroTx Distributed Transactions health check API to verify that the MicroTx Distributed Transactions coordinator is up and running.
    curl --location \ 
              'http://localhost:9000/health' \
              --header 'Accept: application/json'