I have a solution for this.
- run with userland-proxy=false
In /etc/docker/daemon.json {“userland-proxy”: false}
Don’t use -P or -p on the docker create/run command line.
Manually put in iptables rules:
CIP=$(docker inspect --format=’{{.NetworkSettings.IPAddress}}’ container)
iptables -A DOCKER -t nat -p udp -m udp ! -i docker0 --dport 10000:20000 -j DNA
T --to-destination $CIP:10000-20000
iptables -A DOCKER -p udp -m udp -d $CIP/32 ! -i docker0 -o docker0 --dport 100
00:20000 -j ACCEPT
iptables -A POSTROUTING -t nat -p udp -m udp -s $CIP/32 -d $CIP/32 --dport 1000
0:20000 -j MASQUERADE