I have an application in a Docker container. I have the DB in another Docker container. The DB container has an exposed port of 49155. The application requires that the database be exposed on port 3306 and I can't change that thanks to IonCube obfuscation. So, I can point my application to the database container just fine, but the application can't find the DB (wrong port).
My initial solution was to us IPTables to forward local requests on port 3306 to the remote container on port 49155 using:
iptables -t nat -A PREROUTING -p tcp --src 127.0.0.1 --dport 3306 -j REDIRECT --destination 192.168.200.212 --to-ports 49155
Still not working. Any thoughts?
EDIT
From application server tried:
iptables -t nat -I OUTPUT -p tcp --dst 192.168.200.212 --dport 3306 -j REDIRECT --to-ports 49155
and
iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to-destination 192.168.200.212:49155
Still no luck. Also ran nmap -p 3306 -sT 192.168.200.212
which showed 3306 as closed from the perspective of the application server.