Docker Run Command Reference

The docker run command is used for containerizing and running a ActiveMatrix Service Grid - Container Edition application by using a Docker image.

Syntax

docker run  -p <HOST_PORT>:<CONTAINER_PORT>  -e <ENVIRONMENT_VARIABLES> <APPLICATION_IMAGE_NAME>:<IMAGE_VERSION>

Where:

Following are the environment variables you can specify when running the container:

Substitution Variables

You can override values for Substitution Variables by specifying the values as environment variables when running the container.

The format of environment variables must be as follows:

For Shared resource Substitution Variables: svar.sr.<svar_name>=<svar_value>

For Application Substitution Variables: svar.app.<svar_name>=<svar_value>

Example:

docker run -it -p 7777:7777 -p 2222:2222 -p 8010:8010 -e svar.sr.port=8010 -e svar.app.httpconn=httpConnector_new bookstore:1.0
Note: If substitution variable type is password, do not specify plain text for password as SVAR value by using container environment variable, because password value is printed in container logs. But you can specify an encrypted value like '#!fVZYfnXhUJQmJgOVhkPzAwXNpL/xm53B'. For more information about creating an obfuscated password from ActiveMatrix Administrator CLI, see "Creating an Obfuscated Password" in TIBCO ActiveMatrix Service Grid Administration Guide.

Shared Resource User name and Password

You can specify the user name or password for the shared resource as the environment variable when you run the container. The format of the environment variables must be as follows:

To update user name: sr.<SharedResourceName>.username=<NewUserName>

To update Password: sr.<SharedResourceName>.password=<NewPassword>

Note: This applies to the shared resources that use inline credentials (that is user name and password) provided in the Shared Resource Configuration. Example: JDBC Shared Resource

Example:

docker run -it -p 7777:7777 -p 2222:2222 -p 8010:8010 -e svar.sr.port=8010 -e sr.NewJDBCResource.username=USERNAME -e sr.NewJDBCResource.password=password bookstore:1.0

JVM Arguments

You can override JVM arguments set in the image when running the container by passing JAVA_OPTION as environment variable. This overrides JVM arguments set when creating the image.

Example:

docker run --rm -e JAVA_OPTION="-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError" bookstore

JAVA_EXTENDED_OPTION

To add JVM arguments (TRA properties from ActiveMatrix Service Grid 3.x) use this environment variable.

This environment variable adds property to the existing JVM arguments.

For example, to add com.tibco.amf.node.disableSendServerVersion=true, use the JAVA_EXTENDED_OPTION environment variable.

docker run --rm -e JAVA_EXTENDED_OPTION="-Dcom.tibco.amf.node.disableSendServerVersion=true" bookstore

If you are adding more than one properties, add value to the same environment variable:

docker run --rm -e JAVA_EXTENDED_OPTION="-Dcom.tibco.amf.node.disableSendServerVersion=true -Dproperty2=value2" bookstore

For OpenID Single Sign-On with ADFS and SAML Single Sign-On with ADFS, you must pass JVM parameter allowed.referers when running the container:

docker run --rm -p 9895:9895 --name saml_adfs_cont1 --add-host example.com:192.0.2.24 -e JAVA_OPTION="-Xmx1024m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dcom.tibco.amf.hpa.tibcohost.jetty.httpconnector.allowed.referers=accounts.google.com,example.com" saml_adfs:v1

where "example.com" is ADFS machine name.

If you do not pass this JVM configuration then container will fail with the "Invalid Referrer Header" error.

OSGI Console Port

By default all ActiveMatrix Service Grid - Container Edition node enables osgi.console on 2222 port.

This port is configurable when running the container. Set environment variable osgi.console to change it.

Example:

docker run -e osgi.console=<port> <docker image>

valid port range is (0-65535).

You can view the following log lines when container runs:

-init:

SetOsgiConsolePort:
[echo]
[echo]
[echo] #############################################################################################
[echo] #############################################################################################
[echo]
[echo] 16 October 2020 06:08:32
[echo]
[echo] Checking for osgi.console in the environment properties and setting osgi.console if found.
[echo]
[echo] #############################################################################################
[echo] #############################################################################################
[echo]
[echo]
[echo] Setting osgi.console = 2278

BUILD SUCCESSFUL
Total time: 1 second

Use the telnet quit command to close the connection after the debugging session is complete. Do not use the telnet exit command as this will shut down the AMSGCE Node.

Custom Logging Element

  1. Use layout class as com.tibco.tpcl.org.apache.log4j.PatternLayoutEx.
  2. In the Log4j configuration, use logging pattern as %R{_cl.amxce.correlationId}.
  3. Set _cl.amxce.correlationId as environment variable.

Example:

docker run -p 7777:7777  -e _cl.amxce.correlationId=test123 bookstore.

Sample Node Log File:

<layout class="com.tibco.tpcl.org.apache.log4j.PatternLayoutEx">
   <param name="ConversionPattern" value="[%R{_cl.amxce.correlationId}] %R{_cl.physicalCompId.matrix.env} %R{_cl.physicalCompId.matrix.node} [%t] [%-5p] %c - %m%n"/>
</layout>

Sample Output:

As shown in the following sample, each line contains [test123] which is set as environment variable when running the container and the same is mentioned in Log4j configuration file of AMXCE node.

16 Dec 2019 20:41:51,584 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] org.eclipse.jetty.server.Server - jetty-9.2.25.v20180606
16 Dec 2019 20:41:51,614 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] org.eclipse.jetty.util.log.Logger - Opened C:/tibco/scripts/workflows/alacarte/amxce/config.home/tibcohost/AMXCEInstance/host/logs/jetty.2019_12_16.request.log
16 Dec 2019 20:41:51,685 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] org.eclipse.jetty.server.NetworkTrafficServerConnector - Started hello2Connector@6b92a741{HTTP/1.1}{0.0.0.0:7788}
16 Dec 2019 20:41:51,686 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] org.eclipse.jetty.server.Server - Started @47892ms
16 Dec 2019 20:41:51,686 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] com.tibco.amx.hpa.web.jetty.hello2Connector - TIBCO-AMX-HPA-014364: Started Jetty server hello2Connector
16 Dec 2019 20:41:51,759 [test123]   AMXCENode [ComponentFrameworkTask] [INFO ] org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@4778fae8{/helloWorldPT,null,AVAILABLE}