Skip to content
Stand with Ukraine flag

Docker (Windows)

This guide describes how to install and start a standalone TBMQ instance using Docker Desktop on Windows. For cluster installation, see the cluster setup page.

The install script runs TBMQ, PostgreSQL, Kafka, Valkey, and the Integration Executor as Docker containers on one host. Once it is running, TBMQ listens on these ports:

One host · Docker Desktop

  • TBMQ
  • Integration Executor
  • PostgreSQL
  • Kafka
  • Valkey

Ports

  • 8083 HTTP TBMQ UI and REST API
  • 1883 MQTT MQTT clients
  • 8084 MQTT over WebSockets MQTT clients that connect over WebSockets
  • 8883 MQTTS MQTT clients that connect over TLS, once you enable MQTTS

Before proceeding, ensure you have an active TBMQ license. If you don’t have one yet, visit the Pricing page, choose a pay-as-you-go subscription or a perpetual license, and use the calculator to size your deployment — session and throughput limits, production and development instances, and any add-ons — to obtain your license key.

Installation takes three steps: configure the license key, run the install script, then log in to the TBMQ UI.

Open PowerShell as Administrator and go to the directory where you want to keep the TBMQ files. The scripts download and read docker-compose.yml in the current directory.

Configure the license key

Section titled Configure the license key
  1. Download the docker-compose.yml file.

    Terminal window
    Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/docker-compose.yml" `
    -OutFile ".\docker-compose.yml"
  2. Set your license key.

    Open the downloaded docker-compose.yml, find TBMQ_LICENSE_SECRET, and replace YOUR_LICENSE_KEY_HERE with your actual license key.

From the same directory, run the following commands to download and run the TBMQ install script. It uses the docker-compose.yml you edited instead of downloading a new one:

Terminal window
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/windows/tbmq-install-and-run.ps1" `
-OutFile ".\tbmq-install-and-run.ps1"; .\tbmq-install-and-run.ps1

The script downloads the docker-compose.yml file if it is not already in the current directory, creates the necessary Docker volumes, installs the database, and starts TBMQ. It then follows the container logs; press Ctrl+C to stop following them — TBMQ keeps running.

Key configuration points in the docker-compose.yml
Setting Purpose
8083:8083 Exposes the HTTP UI on port 8083
1883:1883 Exposes the MQTT port 1883
8084:8084 Exposes MQTT over WebSockets on port 8084
tbmq-valkey-data:/data Valkey data volume
tbmq-postgres-data:/var/lib/postgresql/data PostgreSQL data volume
tbmq-kafka-data:/var/lib/kafka/data Kafka data volume
tbmq-kafka-secrets:/etc/kafka/secrets, tbmq-kafka-config:/mnt/shared/config Kafka secrets and configuration volumes
tbmq-logs:/var/log/thingsboard-mqtt-broker TBMQ logs volume
tbmq-data:/data TBMQ data directory (contains .firstlaunch after DB installation)
tbmq-ie-logs:/var/log/tbmq-integration-executor Integration Executor logs volume
tbmq Docker service name
tbmq-integration-executor Docker service name of the Integration Executor, which runs integrations
restart: always Auto-restarts TBMQ on system reboot or failure

The PE file also sets the license:

Setting Purpose
TBMQ_LICENSE_SECRET The PE license key you set in Configure the license key
TBMQ_LICENSE_INSTANCE_DATA_FILE: /data/tbmq-instance-license.data Path to the auto-generated instance data file used to identify this TBMQ instance
  1. Open the UI.

    Once installation is complete, access the TBMQ UI at http://{your-host-ip}:8083 in your browser (e.g., http://localhost:8083). You should see the TBMQ login page.

  2. Sign in as System Administrator.

    Use the default System Administrator credentials:

    Username
    sysadmin@thingsboard.org
    Password
    sysadmin
  3. Change the default password.

    On first login, you are prompted to change the default password and re-login with the new credentials.

Run these commands from the directory that contains docker-compose.yml.

View TBMQ logs
docker compose logs -f tbmq
Stop the containers
docker compose stop
Start the containers
docker compose start
  1. Check the version-specific notes below for any preparation your target version requires.
  2. Back up your database (optional but recommended).
  3. Run the upgrade command.

For full version history and supported upgrade paths, see the upgrade instructions page. If the documentation does not cover your specific upgrade path, contact us for guidance.

What each upgrade needs before you run the script — select a version for its full notes:

Upgrade to Before running the upgrade script
2.4.2 Create an empty .tbmq-upgrade.env. Check SCRAM-only authentication and Kafka integrations
2.4.1 Create an empty .tbmq-upgrade.env. If you set MQTT_TOPIC_MAX_SEGMENTS_COUNT, raise it by 1
2.4.0 Create an empty .tbmq-upgrade.env. If you scrape metrics, update queries for the renamed Prometheus metrics
2.3.0 Create an empty .tbmq-upgrade.env
TBMQ to TBMQ PE Add the PE license variables to docker-compose.yml and create .tbmq-upgrade.env for the CE-to-PE migration

Backing up your PostgreSQL database before upgrading is highly recommended but optional. For further guidance, follow the backup and restore instructions.

This is a standard upgrade from v2.4.1PE. No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.

The upgrade script requires a .tbmq-upgrade.env file. If it does not already exist from a previous upgrade, create an empty one:

Terminal window
New-Item -Path .tbmq-upgrade.env -ItemType File -Force

Then proceed with the upgrade.

This is a standard upgrade from v2.4.0PE.

No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.

The upgrade script requires a .tbmq-upgrade.env file. If it does not already exist from a previous upgrade, create an empty one:

Terminal window
New-Item -Path .tbmq-upgrade.env -ItemType File -Force

Then proceed with the upgrade.

This is a standard upgrade from v2.3.0PE.

No third-party component changes are required. The upgrade creates the dropped_msg table used by dropped message analytics; no existing data is changed.

The upgrade script requires a .tbmq-upgrade.env file. If it does not already exist from a previous upgrade, create an empty one:

Terminal window
New-Item -Path .tbmq-upgrade.env -ItemType File -Force

Then proceed with the upgrade.

This is a standard upgrade from v2.2.0PE.

No third-party component changes are required — the official images are already in use since v2.2.0.

The upgrade script requires a .tbmq-upgrade.env file. If it does not already exist from a previous upgrade, create an empty one:

Terminal window
New-Item -Path .tbmq-upgrade.env -ItemType File -Force

Then proceed with the upgrade.

Upgrade from TBMQ to TBMQ PE

Section titled Upgrade from TBMQ to TBMQ PE

CE-to-PE migration is supported for the same version only. If you are on an earlier CE version, upgrade TBMQ CE to the latest version first. For all supported paths, see the upgrade instructions.

  1. Add the PE environment variables.

    Before upgrading, update your docker-compose.yml to include the PE-specific environment variables:

    • TBMQ_LICENSE_SECRET — your license key from the license step;
    • TBMQ_LICENSE_INSTANCE_DATA_FILE — path to the auto-generated instance data file (e.g. /data/tbmq-instance-license.data).
  2. Create the .tbmq-upgrade.env file.

    Terminal window
    @'
    JAVA_TOOL_OPTIONS=-Dinstall.upgrade.from_version=ce
    '@ | Set-Content -Path .tbmq-upgrade.env -Encoding UTF8
  3. Run the upgrade.

    Then proceed with the upgrade.

  1. Go to your installation directory.

    Run the upgrade from the directory that contains docker-compose.yml and .tbmq-upgrade.env.

  2. Download the upgrade script.

    Terminal window
    Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/windows/tbmq-upgrade.ps1" `
    -OutFile ".\tbmq-upgrade.ps1"

    The script upgrades TBMQ PE 2.4.1PE, or TBMQ 2.4.2 (CE), to 2.4.2PE. It changes the tbmq and tbmq-integration-executor image tags in docker-compose.yml, keeping the original as docker-compose.yml.bak, and stops with Failed to replace the image version if the file references neither version.

  3. Check the connection settings.

    The script connects to PostgreSQL and Valkey with the default settings from docker-compose.yml. If you changed them, edit the $db_url, $db_username, $db_password, and $valkey_url variables in tbmq-upgrade.ps1 to match before running it.

  4. Run the upgrade.

    Terminal window
    .\tbmq-upgrade.ps1

    After the database upgrade, the script asks you to confirm removing the stopped tbmq container (Going to remove …-tbmq-1). Answer y; the script then starts TBMQ on the new version.

    The upgrade script stops the tbmq service while the upgrade runs and starts it again afterwards, so expect a brief interruption.

To enable MQTT over SSL/TLS (MQTTS) in TBMQ, provide valid SSL certificates and configure TBMQ to use them.

For details on supported formats and configuration options, see the MQTT over SSL guide.

  1. Prepare SSL certificates.

    Obtain a valid SSL certificate and private key. For example:

    • mqttserver.pem — public certificate (may include the full chain)
    • mqttserver_key.pem — private key
  2. Mount certificates into the container.

    In your docker-compose.yml, mount the directory containing the certificates into the tbmq service:

    docker-compose.yml
    services:
    tbmq:
    volumes:
    - tbmq-logs:/var/log/thingsboard-mqtt-broker
    - tbmq-data:/data
    - PATH_TO_CERTS:/config/certificates

    Replace PATH_TO_CERTS with the path to your certificate files.

    TBMQ runs as the thingsboard user (UID 799) inside the container and must be able to read both files. If TBMQ cannot read a file, it fails to start and logs Permission denied for that file.

  3. Configure environment variables.

    Add the following variables to the tbmq service environment in docker-compose.yml:

    docker-compose.yml
    LISTENER_SSL_ENABLED: "true"
    LISTENER_SSL_PEM_CERT: "/config/certificates/mqttserver.pem"
    LISTENER_SSL_PEM_KEY: "/config/certificates/mqttserver_key.pem"
    LISTENER_SSL_PEM_KEY_PASSWORD: "server_key_password"

    Leave LISTENER_SSL_PEM_KEY_PASSWORD empty if your private key is not password-protected.

  4. Expose the MQTTS port.

    In docker-compose.yml, add the port to the tbmq service:

    docker-compose.yml
    services:
    tbmq:
    ports:
    - "8083:8083"
    - "1883:1883"
    - "8084:8084"
    - "8883:8883"
  5. Restart TBMQ.

    Terminal window
    .\tbmq-install-and-run.ps1

    Once restarted, MQTT clients can securely connect to port 8883 using TLS/SSL.

Connect your first client

Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.

Secure the broker

Choose the authentication provider that fits your clients. See Security overview.

Watch the broker

Track sessions, throughput, and resource usage as traffic grows. See Monitoring.