I have a docker container that services UDP packets and which needs to be on a static address.
I used the following commands:
docker network create --subnet=172.18.0.0/16 mynet123
docker run --net mynet123 --ip 172.18.0.22 -it ubuntu myservice
However I'm not receiving the UDP packets I expect to. I wonder if I need to specify that the UDP port I'm using should be open, however I can't find out how to do this. The documentation talks about the -p option for mapping port from the host to the container which is very much not what I want.
The standard approach of assigning my host the static address and using the -p option to map the port to the container does not work for me, this is because the service looks at the from address of the UDP packet to identify it and that's always the address of the host when you port forward. However I did actually receive the UDP packets when I follow this approach.