Docker Community Forums

Share and learn in the Docker community.

Proper network setting for debian docker image running on windows 10 to allow broadcast packets to network?


(Grexwildahunden) #1

I am working on a c++ imaging application that is designed to run on Debian. But, my development workstation is windows. I have sample code from the camera manufacturer that works when I compile it on the windows computer. It runs and can detect the camera on the network fine.

I created a Dockerfile based on “from Debian” and it launches fine. I can compile and run the sample code in the container. However, it can’t detect the camera. The code runs fine, but reports that it can’t find a camera. The code uses a broadcast packet to the network to find the camera on the network. My theory is that the broadcast packets are not being delivered beyond the windows computer.

I have tried a couple of network configurations. Currently, I created a new bridge network called, “devworkstation” and have assigned the image to that network:

docker run -ti --name devworkstation --network devworkstation --rm -v /var/run/docker.sock:/var/run/docker.sock -v “~/Downloads:/downloads” -e DISPLAY=$env:DISPLAY grexdocker/inplant:devworkstation

Dockerfile:

from debian:9.5
RUN apt-get update
RUN apt-get install -y firefox-esr
RUN apt-get install -y task-mate-desktop
RUN apt-get install -y git vim
RUN apt-get install -y build-essential
RUN apt-get install -y gdb
RUN apt-get install -y valgrind
RUN apt-get install -y linux-image-rt-amd64
RUN apt-get install -y dos2unix
RUN apt-get install -y tcpdump
RUN apt-get install -y netcat
COPY “buildsamples.sh” /root
CMD /bin/bash


(Grexwildahunden) #2

I believe I have it fixed. The main blocker was that docker sets itself up with the MobyLinuxVM attached to the DockerNAT virtual switch which is defined as internal (and not able to change it). To work around it, I opened windows Hyper-V and created a new virtual switch defined as external (Which I named, “DockereGettingStartedExternal”). I then used docker-machine to create a new docker machine associated with the new virtual switch:

docker-machine create -d hyperv --hyperv-virtual-switch “DockerGettingStartedExternal” dev1

#Set up to connect with the new docker machine
docker-machine env dev1

#Then run the image with --net=host. Pre-preq, the image is hosted where the docker machine can pull it.
docker run -ti --name devworkstation --rm -v /var/run/docker.sock:/var/run/docker.sock --net=host {username/imagename}

Now, when I run the sample code, it connects to the camera fine.