C.4 Run MicroTx in a Docker Container on macOS (Arm)

Use the following commands to run MicroTx in an independent Docker container on macOS of Apple M-series (Arm architecture).

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. Create a custom network.
    docker network create otmm_network

    Where, otmm_network is the name of the custom network. Note down this name as you will provide it in the next step.

  2. 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 otmm_network -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 otmm_network is the name of the custom network that you have created in the previous step.
    • tmm:<version> is the MicroTx Docker image that you have loaded to the local Docker repository.
  3. 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 otmm_network \
      -e STORAGE_DB_CREDENTIAL='{"password":"<DBpassword>", "username":"<DBuser>"}' \
      -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-db.yaml specifies the location of the tcs.yaml file, which contains configuration details for the coordinator and Oracle Database credentials.
      • --network otmm_network is the name of the custom network that you have created in the previous step.
      • tmm:<version> is the MicroTx Docker image that you have loaded to the local Docker repository.
  4. Update the participant service URL in the application.properties file of each participant service. For example, http://host.docker.internal:8083.
  5. 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.