I have an application that's composed of several Docker images that is being developed on MacOS and I'm trying to get it started on Windows. Most seem to be working, but there's a Traefik load balancer that doesn't.
On MacOS it just works, but on Windows, whatever URL I access, it gives me a 404, the actual content which is just "404 page not found".
The Traefik configuration looks like this:
logLevel = "INFO"
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.https.tls.defaultCertificate]
certFile = "/certs/cert.pem"
keyFile = "/certs/cert.pem"
# Connection to docker host system (docker.sock)
[docker]
watch = true
domain = "localhost"
[file]
[backends]
[backends.backend-mixpanel]
[backends.backend-mixpanel.servers]
[backends.backend-mixpanel.servers.mixpanel]
url = "https://api.mixpanel.com"
weight = 10
[backends.backend-yieldify]
[backends.backend-yieldify.servers]
[backends.backend-yieldify.servers.yieldify]
url = "https://td.yieldify.com/"
weight = 0
[frontends]
[frontends.frontend-mixpanel]
backend = "backend-mixpanel"
[frontends.frontend-mixpanel.routes.one]
rule = "HostRegexp:localhost,{catchall:.*};Path:/mixpanel/{.*};PathPrefixStripRegex:/{mixpanel}"
priority=10
[frontends.frontend-yieldify]
backend = "backend-yieldify"
[frontends.frontend-yieldify.routes.two]
rule = "HostRegexp:localhost,{catchall:.*};Path:/yieldify/{.*}"
priority=0
While the Dockerfile contains:
FROM traefik:alpine
RUN apk add --update openssl
RUN mkdir -p /certs
RUN openssl req -x509 -newkey rsa:2048 -keyout key.pem -out ca.pem -days 1080 -nodes -subj '/C=UK/ST=London/L=London/O=ProjectX/OU=Engineering team/CN=local.wif'
RUN cat key.pem ca.pem > /certs/cert.pem
The relevant docker-compose.yml section contains:
lb:
image: load-balancer
build: ${WORKSPACE}/go-home/load_balancer
ports:
- 80:80
- 443:443
links:
- wifi-ui-dev
- wifi-ui-prod
- portal
- wifi-api
env_file:
- .env
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro,delegated
- ${PWD}/load_balancer/traefik.toml:/etc/traefik/traefik.toml:ro,delegated
And when I get the 404 I get nothing sent to the console (stdout and stderr) for that Docker image.
Any ideas what's going on or how to get closer to a reason why it's not working?
One of my worries was the socket volume:
- /var/run/docker.sock:/var/run/docker.sock:ro,delegated
Checking the running container, the file looks like a socket:
/ # ls -laF /var/run/docker.sock
srw-rw---- 1 root root 0 Sep 2 11:04 /var/run/docker.sock=
Just in case, I tried replacing that line with:
- //./pipe/docker_engine:/var/run/docker.sock
or with:
- type: npipe
source: ////./pipe/docker_engine
target: /var/run/docker.sock
consistency: delegated
both of which resulted in the socket looking like a directory:
/ # ls -laF /var/run/docker.sock
total 4
drwxr-xr-x 2 root root 40 Sep 3 14:52 ./
drwxr-xr-x 1 root root 4096 Sep 3 14:57 ../