Hello. The small company I am working for is developing an IoT app that should end the need for 10000 aps for your smart devices.
I need to dockerize my expressJs API(s). We have a cloud that is used for login and remote access only. The api that does the whole work it will be on a local hub. We will offer hardware and software versions of our app.
For the software version the local api is a container based on nodejs. Database is a mongoDB. I created a simple docker-compose that starts the mongodb container and our hub container.
I need to be able to get host local ip address every time the docker container starts, in order to send updates to the cloud. The app will be able to detect if you are on the local network, so you can use your local smart devices even if your internet connetion is down, as long as you are on same local network with the hub.
For that, every time the api starts, I post an update of the local ip of the hub to the cloud, so you know the right local ip on every project (hub) of yours.
The only way I managed to do it for every platform is having a python script that gets the local ip and replaces it in docker-compose > service > environments.
I am pretty new to docker, i’m kind of a one man army and have no one to ask for guidance, and I’m commited to do the job in the proper way.
Other then a few basic demos at college, I did not use docker.
How I can pass the local ip of the host machine to the nodejs app, so it can send it securely to the cloud.
The other option is to do this part outside of docker container, but I dont like the extra steps for the ease of use.
Thank you for your time, I hope this is possible.