thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.74k stars 844 forks source link

[HELP] Access IP outside the Docker container #795

Closed emrekardaslar closed 2 years ago

emrekardaslar commented 2 years ago

Describe the issue I created a docker image and set the options to make configurations outside the container following your instructions. I want to access a port that is accessible by the host machine. How can I do that? For example: In tb_gateway.yaml, I want to enter an IP which is accessible from the host machine, how can I do that? I know it is more of a Docker question but if you can help me it would be great! Thank you.

Versions (please complete the following information):

samson0v commented 2 years ago

Hi @emrekardaslar, please, send your Docker file and/or command you run it. Also, send the config file of the connector. Thanks for your interest in ThingsBoard IoT Gateway!

emrekardaslar commented 2 years ago

Actually, the docker file is the same as the existing one (https://github.com/thingsboard/thingsboard-gateway/blob/master/docker/Dockerfile)

I tried to run several commands:

I used MQTT config as: { "broker": { "port": 1883, "host": "127.0.0.1", "maxMessageNumberPerWorker": 20, "maxNumberOfWorkers": 200 }, "mapping": [ .....}

I know that I can reach 127.0.0.1 using host.docker.internal, I want to use different IPs.

Thanks for replying!

samson0v commented 2 years ago

Hi @emrekardaslar, if I understand you in the right way, you have to use the next command, also try to find the solution in the official docker documentation. Thanks for your interest in ThingsBoard IoT Gateway!