Stand with Ukraine flag
Try it now Pricing
IoT Gateway
Community Edition Professional Edition Cloud Edge PE Edge IoT Gateway License Server Trendz Analytics Mobile Application PE Mobile Application MQTT Broker
Installation > IoT Gateway installation using Docker (Windows)
Getting Started Documentation
On this page

Install ThingsBoard IoT Gateway using Docker.

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

Prerequisites

Running

Click the Docker QuickStart icon to launch a pre-configured Docker Toolbox terminal.

Make sure your have logged in to docker hub using command line.

Execute the following command to run this docker directly:

1
docker run -it -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\logs:/thingsboard_gateway/logs -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\extensions:/thingsboard_gateway/extensions -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\config:/thingsboard_gateway/config --name tb-gateway -p 60000-61000:60000-61000 --restart always thingsboard/tb-gateway

Where:

  • docker run - run this container
  • -it - attach a terminal session with current Gateway process output
  • %HOMEPATH% - current user’s home dir
  • %HOMEDRIVE% - current user’s home drive
  • -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\config:/thingsboard_gateway/config - mounts the host’s dir %HOMEDRIVE%%HOMEPATH%\tb-gateway\config to Gateway config directory
  • -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\extensions:/thingsboard_gateway/extensions - mounts the host’s dir %HOMEDRIVE%%HOMEPATH%\tb-gateway\extensions to Gateway extensions directory
  • -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\logs:/thingsboard_gateway/logs - mounts the host’s dir %HOMEDRIVE%%HOMEPATH%\tb-gateway\logs to Gateway logs directory
  • --name tb-gateway - friendly local name of this machine
  • -p 60000-61000:60000-61000 - publish range of ports from 60000 to 61000
  • --restart always - automatically start ThingsBoard in case of system reboot and restart in case of failure.
  • thingsboard/tb-gateway - docker image

Running (with environmental variables)

Execute the following command to run docker container with environmental variables:

1
docker run -it -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\logs:/thingsboard_gateway/logs -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\extensions:/thingsboard_gateway/extensions -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\config:/thingsboard_gateway/config --name tb-gateway -p 60000-61000:60000-61000 -e host=thingsboard.cloud -e port=1883 -e accessToken=ACCESS_TOKEN --restart always thingsboard/tb-gateway
Doc info icon

Environmental variables will override configuration parameters.

Available environmental variables:

ENV Description
host ThingsBoard instance host.
port ThingsBoard instance port.
accessToken Gateway access token.
caCert Path to CA file.
privateKey Path to private key file.
cert Path to certificate file.

Detaching, stop and start commands

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

To reattach to the terminal (to look at Gateway logs) run:

1
docker attach tb-gateway

To stop the container:

1
docker stop tb-gateway

To start the container:

1
docker start tb-gateway

Gateway configuration

Stop the container:

1
docker stop tb-gateway

Open the directory with configuration files:

%HOMEDRIVE%%HOMEPATH%\tb-gateway\config

Configure gateway to work with your instance of ThingsBoard, using this guide:

Start the container after made changes:

1
docker start tb-gateway

Upgrading

In order to update to the latest image, execute the following commands:

1
2
3
4
$ docker pull thingsboard/tb-gateway
$ docker stop tb-gateway
$ docker rm tb-gateway
$ docker run -it -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\logs:/thingsboard_gateway/logs -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\extensions:/thingsboard_gateway/extensions -v %HOMEDRIVE%%HOMEPATH%\tb-gateway\config:/thingsboard_gateway/config --name tb-gateway -p 60000-61000:60000-61000 --restart always thingsboard/tb-gateway

Build local docker image

In order to build local docker image, follow the next steps:

  1. Copy Dockerfile to root folder, using the following command:
    1
    
     copy docker\Dockerfile .
    
  2. From project root folder execute the following command:
    1
    
     docker build -t local-gateway .