C.1 Run MicroTx in a Docker Container on macOS or Linux

Use the following commands to run MicroTx in an independent Docker container on macOS (Intel x86) and Linux operating systems.

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 is a network configuration. In macOS, the callback URL is host.docker.internal2. In Linux operating systems, 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. Use the following command to run MicroTx in a Docker container while providing credentials to access Oracle Database. Replace <DBpassword> and <DBuser> with the password and user name to access Oracle Database in your environment.

      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 \
      -e STORAGE_DB_CREDENTIAL='{"password":"<DBpassword>", "username":"<DBuser>"}' \
      -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.yaml file, which contains configuration details for the coordinator and Oracle Database credentials.
      • --network=host is a network configuration. In macOS, the callback URL is host.docker.internal2. In Linux operating systems, the callback URL is an 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.