This guide will help you to install and start ThingsBoard Gateway using Docker on Linux or Mac OS.
Running
Execute the following command to run this docker directly:
1
docker run -it -v ~/.tb-gateway/logs:/thingsboard_gateway/logs -v ~/.tb-gateway/extensions:/thingsboard_gateway/extensions -v ~/.tb-gateway/config:/thingsboard_gateway/config --name tb-gateway --restart always thingsboard/tb-gateway
Where:
docker run- run this container-it- attach a terminal session with current Gateway process output-v ~/.tb-gateway/config:/thingsboard_gateway/config- mounts the host’s dir~/.tb-gateway/configto Gateway config directory-v ~/.tb-gateway/extensions:/thingsboard_gateway/extensions- mounts the host’s dir~/.tb-gateway/extensionsto Gateway extensions directory-v ~/.tb-gateway/logs:/thingsboard_gateway/logs- mounts the host’s dir~/.tb-gateway/logsto Gateway logs directory--name tb-gateway- friendly local name of this machine--restart always- automatically start ThingsBoard in case of system reboot and restart in case of failure.thingsboard/tb-gateway- docker image
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 see 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
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 ~/.tb-gateway/logs:/var/log/thingsboard-gateway -v ~/.tb-gateway/extensions:/var/lib/thingsboard_gateway/extensions -v ~/.tb-gateway/config:/etc/thingsboard-gateway/config --name tb-gateway --restart always thingsboard/tb-gateway