I am new to Docker, Drone Programming and this community. I was able to deploy a python script (that contains dronekit code) to docker container on my Windows 10. To run the script, I need to connect to a service on my host. I have provided a snippet below, Windows has a program running(Mavproxy SITL) which has exposed 127.0.0.1:14550 which is UDP. My image should connect to this address.
mydronectrlscript.py
from dronekit import connect
// Connect to UDP endpoint.
vehicle = connect(‘127.0.0.1:14550’, wait_ready=True)
// Use returned Vehicle object to query device state - e.g. to get the mode:
print(“Mode: %s” % vehicle.mode.name)
I did read documents related to connecting container to host service:
Though I understand I can use host.docker.internal, I am not sure how to use it? I don’t see an example on how to use it. Is it passed in docker run command ? Will the use of host.docker.internal allow py script to access host’s UDP 127.0.0.1:14550 address ?
Also, I will soon be deploying this image to my Raspberry Pi Raspbian OS. I understand host.docker.internal can’t be used there. Do you happen to have example on how to do it on Linux as well?