Stop the war

Support Ukraine

Try it now Pricing
Edge
Community Edition Professional Edition Cloud Edge PE Edge IoT Gateway License Server Trendz Analytics Mobile Application PE Mobile Application
Installation > Step 2 - Install instructions > Docker (Windows)
Getting Started Documentation
Architecture API FAQ

On this page

Installing ThingsBoard Edge using Docker (Windows)

Rules of Compatibility Between ThingsBoard Edge and ThingsBoard Server Versions:

  • ThingsBoard Edge version X.Y.Z is compatible with ThingsBoard Server version X.Y.Z and subsequent versions.
  • ThingsBoard Edge version X.Y.Z is NOT compatible with ThingsBoard Server versions prior to X.Y.Z.

Example: ThingsBoard Edge version 3.3.4.1 is compatible with ThingsBoard server version 3.3.4.1 and later versions (3.4.0, 3.4.1, …). However, ThingsBoard Edge version 3.4.0 is NOT compatible with ThingsBoard server version 3.3.4.1 or earlier versions (3.3.4, 3.3.3, …). In such a case, ThingsBoard Server 3.3.4.1 or an earlier version should first be upgraded to ThingsBoard Server 3.4.0 or a later version.

Please ensure that the ThingsBoard Server is updated to the latest version before proceeding.

This guide will help you to install and start ThingsBoard Edge using Docker on Windows.

Prerequisites

ThingsBoard Cloud server

To begin using ThingsBoard Edge, you must have a ThingsBoard server supporting edge functionality up and running.

The easiest way is to use Live Demo server.

The alternative option is to install ThingsBoard Community Edition server on-premise. Please visit Install CE to install server.

Edge provision on cloud

Additionally, you will need to provision ThingsBoard Edge on a cloud server. If you haven’t done so yet, please follow the Provision Edge on Cloud guide.

Once the ThingsBoard Edge is provisioned on the cloud server, please follow the installation steps provided below.

Docker installation

Edge Hardware Requirements

The hardware requirements for ThingsBoard Edge depend on the number of devices connected to the edge and the extent of GUI usage locally.

If you’re planning to run ThingsBoard Edge without heavy GUI usage (local dashboards, device management, etc.), and you have a relatively small number of devices (under 100) connected to a single machine, then a minimum of 1GB of RAM should suffice.

On the other hand, if you anticipate heavy GUI usage (local dashboards, device management, etc.) and you’re connecting 100+ devices on a single machine, we recommend having at least 4GB of RAM to ensure optimal performance.

Step 1. Running ThingsBoard Edge

Here you can find ThingsBoard Edge docker image:

Windows users should use docker managed volume for ThingsBoard Edge DataBase. Create docker volume (for ex. mytb-edge-data) before executing docker run command: Open “Docker Quickstart Terminal”. Execute the following command to create docker volume:

1
2
3
docker volume create mytb-edge-data
docker volume create mytb-edge-logs
docker volume create mytb-edge-data-db

Create docker compose file for ThingsBoard Edge service:

1
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
version: '3.0'
services:
  mytbedge:
    restart: always
    image: "thingsboard/tb-edge:3.5.1EDGE"
    ports:
      - "8080:8080"
      - "1883:1883"
      - "5683-5688:5683-5688/udp"
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tb-edge
      CLOUD_ROUTING_KEY: PUT_YOUR_EDGE_KEY_HERE # e.g. 19ea7ee8-5e6d-e642-4f32-05440a529015
      CLOUD_ROUTING_SECRET: PUT_YOUR_EDGE_SECRET_HERE # e.g. bztvkvfqsye7omv9uxlp
      CLOUD_RPC_HOST: PUT_YOUR_CLOUD_IP # e.g. 192.168.1.250 or demo.thingsboard.io
    volumes:
      - mytb-edge-data:/data
      - mytb-edge-logs:/var/log/tb-edge
  postgres:
    restart: always
    image: "postgres:12"
    ports:
      - "5432"
    environment:
      POSTGRES_DB: tb-edge
      POSTGRES_PASSWORD: postgres
    volumes:
      - mytb-edge-data-db:/var/lib/postgresql/data
volumes:
  mytb-edge-data:
    external: true
  mytb-edge-logs:
    external: true
  mytb-edge-data-db:
    external: true

Where:

  • restart: always - automatically start ThingsBoard Edge in case of system reboot and restart in case of failure;
  • 8080:8080 - connect local port 8080 to exposed internal HTTP port 8080;
  • 1883:1883 - connect local port 1883 to exposed internal MQTT port 1883;
  • 5683-5688:5683-5688/udp - connect local UDP ports 5683-5688 to exposed internal COAP and LwM2M ports;
  • mytb-edge-data:/data - mounts the host’s dir mytb-edge-data to ThingsBoard Edge DataBase data directory;
  • mytb-edge-logs:/var/log/tb-edge - mounts the host’s dir mytb-edge-logs to ThingsBoard Edge logs directory;
  • mytb-edge-data/db:/var/lib/postgresql/data - mounts the host’s dir mytb-edge-data/db to Postgres data directory;

  • thingsboard/tb-edge:3.5.1EDGE - docker image;

  • CLOUD_ROUTING_KEY - your edge key;
  • CLOUD_ROUTING_SECRET - your edge secret;
  • CLOUD_RPC_HOST - ip address of the machine with the ThingsBoard platform;

Please set CLOUD_RPC_HOST with an IP address of the machine where ThingsBoard version is running:

  • DO NOT use ‘localhost’ - ‘localhost’ is the ip address of the edge service in the docker container.

  • Use demo.thingsboard.io if you are connecting edge to ThingsBoard Live Demo for evaluation.

  • Use X.X.X.X IP address in case edge is connecting to the cloud instance in the same network or in the docker.

If ThingsBoard Edge is set to run on the same machine where the ThingsBoard server is operating, you need to update additional configuration parameters to prevent port collision between the ThingsBoard server and ThingsBoard Edge.

Please update next lines of docker-compose.yml file:

ports:
- “18080:8080”
- “11883:1883”
- “15683-15688:5683-5688/udp”

Ensure that the ports listed above (18080, 11883, 15683-15688) are not being used by any other application.

Set the terminal in the directory which contains the docker-compose.yml file and execute the following commands to up this docker compose directly:

1
2
docker compose up -d
docker compose logs -f mytbedge

ThingsBoard supports Docker Compose V2 (Docker Desktop or Compose plugin) starting from 3.4.2 release, because docker-compose as standalone setup is no longer supported by Docker.

We strongly recommend to update to Docker Compose V2 and use it.

If you still rely on using Docker Compose as docker-compose (with a hyphen), then please execute the following commands to start ThingsBoard:
docker-compose up -d
docker-compose logs -f mytbedge

In order to get access to necessary resources from external IP/Host on Windows machine, please execute the following commands:

1
2
3
4
set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"
VBoxManage controlvm "default" natpf1 "tcp-port8080,tcp,,8080,,8080"  
VBoxManage controlvm "default" natpf1 "tcp-port1883,tcp,,1883,,1883"
VBoxManage controlvm "default" natpf1 "tcp-port5683,tcp,,5683,,5683"

Where:

  • C:\Program Files\Oracle\VirtualBox - path to your VirtualBox installation directory

Step 2. Open ThingsBoard Edge UI

Once started, you will be able to open ThingsBoard Edge UI using the following link http://localhost:8080.

Use next ThingsBoard Edge UI link http://localhost:18080 if you updated HTTP 8080 bind port to 18080.

Please use your tenant credentials from local cloud instance or ThingsBoard Live Demo to log in to the ThingsBoard Edge.

Step 3. Detaching, stop and start commands

You can detach from session terminal using Ctrl-p Ctrl-q key sequence - the container will keep running in the background.

In case of any issues you can examine service logs for errors. For example to see ThingsBoard Edge container logs execute the following command:

1
docker compose logs -f mytbedge

To stop the container:

1
docker compose stop mytbedge

To start the container:

1
docker compose start mytbedge

Docker Compose as docker-compose (with a hyphen) is deprecated. It is recommended to use Docker Compose V2 instead.
If you still rely on docker compose as standalone here is the list of the above commands:
docker-compose logs -f mytbedge
docker-compose stop mytbedge
docker-compose start mytbedge

Troubleshooting

DNS issues

NOTE If you observe errors related to DNS issues, for example

1
127.0.1.1:53: cannot unmarshal DNS message

You may configure your system to use Google public DNS servers

Next Steps

Congratulations! You have successfully provisioned, installed and connected ThingsBoard Edge to ThingsBoard server.

You can continue with Getting started guide to get the basic knowledge of ThingsBoard Edge or you can jump directly to more advanced topics: