1. Home
  2. FlexRule Server
  3. Installation
  4. Run FlexRule Server in Docker Containers

Run FlexRule Server in Docker Containers

◷ Reading Time: 9 minutes

FlexRule Server 8.0+ can be run in a Docker container.

Using a single container image we can specify whether we want to run a container as a master or agent node.

Simple Architecture using Docker Desktop

The simplest architecture using Docker containers is deploying two containers: one master and one agent.

The examples on this page use the architecture above to run FlexRule Server.

  • The addresses will use the host machine’s IP address for routing.
    • http://[host]:9000 goes to the Master API.
    • http://[host]:9010 goes to the Workbench.
    • http://[host]:9003 goes to the Agent API.
  • All nodes must have access and connect to the same database.
    (Ensure your firewall settings allow this)

Before you Start

These steps are necessary to facilitate and test the network communications between the containers, the host PC, and the SQL database.

1. Install and become familiar with using Docker Desktop.

Download and install Docker Desktop from the following address:

You will need to be a competent user of Docker Desktop in order to follow this guide. If you’re not you can go through the documentation and resources on the Docker website: https://docs.docker.com/get-started/

2. Configure a SQL Server Database for FlexRule Server.

FlexRule Server will need to connect to a database. To create this database, you can run the FlexRule Server Master Windows installer. As part of the installation wizard, you will be given the option to connect to SQL Server and create a new database. Once you create this database you can use it in the Docker Containers version of FlexRule Server.

You must install the On-Premise Windows version of FlexRule Server Master and create the database and configuration file. Then, you will be able to use the values from the configuration file for your Docker Container version of FlexRule Server.

3. Allow remote connections to SQL Server.

If you’re using SQL Server as the database you need to ensure:

  • Remote connections are allowed.
    You can find this option in SQL Server Management Studio.
    Right Click on Server > Properties > Connections
  • SQL Server Authentication is enabled.
    You can find this option in SQL Server Management Studio.
    Right Click on Server > Properties > Security
  • SQL Server Browser service is running.
    You can find this in the SQL Server Configuration Manager.
    SQL Server Services
  • Client Protocols for communication are enabled.
    You can find this in the SQL Server Configuration Manager.
    SQL Native Client 11.0 Configuration > Client Protocols

4. Allow access through the Firewall.

Depending on the Firewall software/hardware being used, you’ll need to allow communication on particular ports. In this guide, we’re using ports 9000, 9003, and 9010.

You can disable the firewall altogether for testing purposes if you prefer but please make sure you understand the risks involved in your environment.

How to Run FlexRule Server

You must install the On-Premise Windows version of FlexRule Server Master and create the database and configuration file before proceeding. The configuration files created will have the values you need for the Docker Command Generator.

Find your Configuration Values

Open the configuration files you created from your FlexRule Server On-Premise Windows installation.

[Server Install Path]\Master\FlexRule.Server.Master.dll.config
[Server Install Path]\ExecAgent\FlexRule.Server.ExecAgent.dll.config

e.g. C:\Program Files (x86)\Pliant Framework\FlexRule Server\8.0.117\Master\FlexRule.Server.Master.dll.config
e.g. C:\Program Files (x86)\Pliant Framework\FlexRule Server\8.0.117\ExecAgent

These two files are in an XML format and contain the keys and values you will need for the docker configuration in the next step.

Use the Docker Command Generator

Complete the form on the Docker Command Generator page and click Generate to create commands. You will use these commands to run FlexRule Server.

  1. Open two separate command-line interfaces (e.g. Command Prompt) which are able to run docker commands.
  2. Copy and paste the generated command for the Agent into the first CLI and press Enter to start the Agent.
  3. Copy and paste the generated command for the Master into the second CLI and press Enter to start the Master.

Ensure FlexRule Server Agent is running before you start FlexRule Server Master.

When the Agent has started successfully you should see this message in the CLI:
FlexRule Server, Execution Agent Is Ready.

When the Master has started successfully you should see this message in the CLI:
FlexRule Server, Master Node Is Ready.

If the CLI shows that both Agent and Master are running, you can navigate to the Workbench using your host IP address followed by the Workbench port in your browser. E.g.

Execute a service to test the deployment.

Once you have access to the Workbench, use our Service Execution articles to learn how to test FlexRule Server.

Advanced Configuration

You can customize the docker run commands further to fit your scenario by looking at the configuration settings required to run FlexRule Server.


Restarting FlexRule Server

If FlexRule Server Agent or Master does not start successfully you should see errors in the console. In order to fix these issues and try to restart the Agent or Master, you will need to stop the containers and remove them.

Use the following commands to stop ALL containers and then remove them.

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

SQL Server Issues

Failed to start FlexRule Master Server: Number: 0
Type: System.Data.SqlClient.SqlException
Message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

There are several common reasons this can happen:

1. The address to the server is incorrect.

2. SQL Server has not been set up to receive remote connections.

3. The firewall on your machine or network is blocking the connection.

You can check whether the server address is contactable by using SQL Server Management Studio to connect to it. If you can’t use the server address exactly as you enter it into the Docker Command Generator, it will not work with FlexRule Server either.

Specified Port Already Exists

Error response from daemon: failed to create endpoint [endpoint] on network nat: hnsCall failed in Win32: The specified port already exists. (0x803b0013).

The port you are trying to use is already assigned to an application and cannot be created for FlexRule Server. If another application is using this port you will need to choose a different port or stop the application using this port.

This can also happen if you haven’t stopped the container from a previous instance of FlexRule Server. If FlexRule Server is stopped or unsuccessful when starting, you must stop and remove the relevant containers. This will free up the port so you can start the container again.

License Initialization

Type: FlexRule.Server.License.LicenseInitializationException
Message: License initialization error: 5

Your license key is invalid or was entered incorrectly.

  • Ensure you are entering the FlexRule Server license key and the FlexRule Runtime license key into the correct fields. These are two separate keys used for different products.
  • The values entered into the form fields when generating the commands should not include single quotes or double quotes around the key.

If you don’t have a valid license for FlexRule Server or FlexRule Runtime, please contact FlexRule support to obtain a trial license.

Cryptographic Exception

System.Security.Cryptography.CryptographicException : Padding is invalid and cannot be removed.

This exception occurs when one of the keys in the command configuration (most likely MasterEncryptionPassword) does not match the database’s keys. You’ll need to ensure you have entered key values into the Docker Command Generator which match the database you are connecting to. If in doubt, you can always refer to the config files for your FlexRule Server Windows installation.

Service Execution Error

FlexRule.Server.Commands.CommandHandlerException : Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.

This execution can occur when you run a service on workbench. It can be due to wrong Agent configurations. As the solution, delete the currently using agent and add an agent with the correct host URL (eg: instead of editing an existing agent. No need to restart the services after adding the agent.

Video Tutorial

Updated on August 31, 2020

Was this article helpful?

Related Articles