Networking Between Docker Containers

If you don't want to use a docker-compose file for whatever reason you can create networking between containers manually.

How to set networking for DecisionRules in docker

How to setup multi-container app

What containers will we need:

  1. Server App

  2. Client App

  3. Business Intelligence App

  4. Redis

  5. MongoDB

Method 1: Setup with terminal

First of all, we need to create a docker network because containers, by default, don't see other containers thus they cannot communicate with each other. We will use a simple command docker network create

Note: If you are using PowerShell on Windows you need to use `` for multi-line command!

// creating docker network space
docker network create <network_name>

// if you want to remove network
docker network remove <network_name>

In the second step, we need to run all mandatory containers mentioned above. We will do it with the help of docker run . In this command, we will set ports and env variables as well.

// create mongoDB docker container
docker run -dp 27017:27017 --network decisionrules mongo
// create redis docker container
docker run -dp 6379:6379 --network decisionrules redis

If the command is successful it prints containers id

// creating decisionrules server container
docker run -d -p 8080:8080 -p 8081:8081 
--network decisionrules
-e WORKERS_NUMBER=1
-e REDIS_URL=YOUR_REDIS_URL
-e MONGO_DB_URI=YOUR_MONGODB_URL
-e BI_MONGO_DB_URI=YOUR_BI_MONGODB_URL
-e CLIENT_URL=YOUR_CLIENT_URL
-e LICENSE_KEY=YOUR_LICENSE_KEY
-v license:/assets/lic/ decisionrules/server

Your env properties configuration may vary. For all possibilities go here

// creating decisionrules client container
docker run -dp 80:80 --network decisionrules -e API_URL=YOUR_CLIENT_URL BI_API_URL=YOUR_BI_URL decisionrules/client
// creating decisionrules business intelligence container
docker run -dp 82:82 --network decisionrules -e BI_MONGO_DB_URI=YOUR_MONGO_URI decisionrules/business-intelligence

Hurray! It is done. Now you can go to localhost:80 a DecisionRules should be up and running.

Method 2: Setup with docker-compose file

You can use docker-compose for a very easy setup.

version: "3.7"

services:
  server:
    image: decisionrules/server
    environment:
      - "SHOWCASE=false"
      - "REDIS_URL=YOUR_REDIS_URL"
      - "MONGO_DB_URI=YOUR_MONGO_URI"
      - "CLIENT_URL=YOUR_CLIENT_URL"
      - "LICENSE_KEY=YOUR_LICENSE_KEY"
    ports:
      - "8080:8080"
      - "8081:8081"
    links:
      - mongoDb
      - redis
  client:
    image: decisionrules/client
    environment:
      - "API_URL=YOUR_API_URL"
      - "BI_API_URL=YOUR_BI_API_URL"
    ports:
    - "80:80"
    
  business-intelligence:
    image: decisionrules/business-intelligence
    environment:
      - "BI_MONGO_DB_URI=YOUR_MONGO_URI"
    ports:
    - "8082:8082"  

  mongoDb:
    image: mongo
    ports:
      - "27017:27017"

  redis:
    image: redis
    ports:
      - "6379:6379"

Last updated

Was this helpful?


#843: Audit API chages

Change request updated