For what it’s worth, I ran into this problem. I’m using Vagrant with the Docker provider, so the specifics are different, but the effect is the same.
I was able to fix it with the following in my Vagrantfile
config.vm.network :private_network,
docker_network__opt: com.docker.network.bridge.gateway_mode_ipv4=nat-unprotected
I recognize that isn’t directly applicable for docker-compose, but maybe someone will be able to translate it appropriately.