The problem might be with containers you setup using docker-compose. By default new network is created for services in docker-compose.yml file. This leads that you are not just having docker0 interface with 172.17.0.0/16 subnet setup but also usually other interfaces 172.x.0.0/16.
To overcome this you should add more rules for your networks:
$ iptables -t nat -A POSTROUTING ! -o br-XXX -s 172.YYY.0.0/16 -j MASQUERADE
where br-XXX is interface name, 172.YYY.0.0/16 - subnet.
Alternatively, use single docker0 network by having in your docker-compose.yml for each service described:
network_mode: bridge