C.2 Run MicroTx in a Docker Container on Windows

Use the following commands to run MicroTx 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 Docker image and updated the tcs.yaml file. The tcs.yaml file is located at installation_directory/otmm-<version>/otmm/image in your local machine. This file contains the deployment configuration details for MicroTx. The properties in the tcs.yaml and tcs-docker-swarm.yaml files are similar. For information about the configuration details, see Configure the tcs-docker-swarm.yaml File.

Run MicroTx 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 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 Docker image that you have loaded to the local Docker repository.
  2. Use the following commands to run MicroTx 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 Transaction 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 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 Docker image that you have loaded to the local Docker repository.
  3. After MicroTx is installed, run the MicroTx health check API to verify that the MicroTx coordinator is up and running.
    curl --location \ 
              'http://localhost:9000/health' \
              --header 'Accept: application/json'

What's next? Install and run sample applications in your environment. See Deploy Sample Applications.