A bit late, but you may need to add the following to your docker-compose.yaml:
docker-compose.yaml
network_mode: bridge
Possibly also specify localhost: 127.0.0.1:5000:5000.
127.0.0.1:5000:5000