Using docker-compose, we set up two apps, one running as a docker container, the other running locally. Additionally, we’re using traefik as a docker container to route requests based on path and proxy them to the appropriate app. We are using a public domain we control that resolves to 127.0.0.1, and run dnsmasq as a docker container which resolves that domain to the docker bridge network gateway ip, usually 172.17.0.1.
This snippet from the docker-compose.yml may be more explicit:
version: "2"
services:
app1:
image: kapost/app1
ports:
- "3008:3008"
expose:
- "3008"
network_mode: bridge
dns:
- ${DNS_SERVER_IP}
dnsmasq:
image: kapost/dnsmasq
command: --address /kpst.me/${GATEWAY_IP} --log-facility=-
network_mode: bridge
cap_add:
- NET_ADMIN
traefik:
image: kapost/traefik
command: traefik --web --logLevel=debug
volumes:
- /var/run/docker.sock:/var/run/docker.sock
network_mode: bridge
dns:
- ${DNS_SERVER_IP}
ports:
- "80:80"
- "443:443"
- "8080:8080"
expose:
- "80"
- "443"
- "8080"
networks:
default:
external:
name: bridge
The traefik config is set to proxy /app1
to :3008
, and /app2
to :3005
. When both apps run as docker containers, this works fine, but when we stop app2 and start it on the local host, treafik can no longer “see” it, and returns a Bad Gateway error.
This used to work on an earlier version of Docker for Mac, and also works fine on docker on linux. The local app server is bound to 0.0.0.0:3005, so should be visible to the bridge network. Did something change in the Docker for Mac network configuration recently (last couple months) that might have caused this? Perhaps a firewall rule, or port-forwarding? Is there a way I can configure it back?