The question I have has been asked before, but has not been answered. For example;
I've configured the host of a couple of nginx containers (with labels) in docker-compose. I can reach these containers from my host machine (Mac with docker-for-mac) because I also changed my host file.
curl api.foobar.local/ # works on my host machine
However, if I curl the same host from Inside a container (on the same network) I get an connection refused. If I curl the service name its works, meaning they are on the same network.
curl api.foobar.local/arts # connection refused from inside (other) container curl foobar_api:/foo # 200 response from inside (other) container
I think somehow I will need to add "something" to my
docker-compose.yaml so that to the host file of the
other_container a new rule will be added. Just like I did on my host machine;
api.foobar.local IP_OF_CONTAINER_ON_NETWORK .
What do I need to add to this?
foobar_api: ... other docker-compose config networks: - proxy labels: - traefik.http.routers.osl_api.rule=Host(`api.foobar.local`) - traefik.enable=true - traefik.docker.network=proxy other_container: ... other docker-compose config networks: - proxy labels: - traefik.http.routers.osl_api.rule=Host(`other-container.local`) - traefik.enable=true - traefik.docker.network=proxy