Docker Container forwarding not working can't access remote server from inside container

Ubuntu 18.04 host
Docker 18.09.0 / API 1.39

Container is built from ubuntu:latest and installs nginx, php-fpm, Oracle OCI8 and MSSQL php extensions. Drivers show up fine in php info page. And I can access the oracle DB since it is on the same network as the docker host but the remote MSSQL server is unreachable.

PHP/MSSQL client works fine from servers not inside containers, but even after following the docs to enable forwarding I still can’t communicate. My daemon.json only contains dns server settings and I have restarted networking on the host and restarted the docker service in hopes this would “take effect” but it’s not working.

I enabled:

$ sysctl net.ipv4.conf.all.forwarding=1

And then ran:

$ sudo iptables -P FORWARD ACCEPT

The output from my IP tables:

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all – anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all – anywhere anywhere
ACCEPT all – anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all – anywhere anywhere
ACCEPT all – anywhere anywhere
ACCEPT all – anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp – anywhere 172.17.0.2 tcp dpt:http

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all – anywhere anywhere
RETURN all – anywhere anywhere

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all – anywhere anywhere
RETURN all – anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all – anywhere anywhere

Update:
On a second instance of this container’s image I installed ping and I can ping the remote server but I still cannot connect to it through PHP code. I use this EXACT same PHP code block on other servers that haven’t been containerized yet and it works perfectly fine.