Thanks for your reply @zespri. I agree with your comment about curl not being able to resolve whoami.docker.local. After posting I had added whoami.docker.local to the 127.0.0.1 entry in /etc/hosts
on my laptop. This didn't work as desired but I don't recall the exact result.
Once nice thing about all of this is that it's pretty simple to start over and try again. So I spent time yesterday doing exactly that, and took perhaps a more incremental approach. I've published this effort on github: https://github.com/salderma/traefik-concept, the entire docker-compose.yml
file is there, but I've put the relevant parts below:
- just HTTP over port 80 to the whoami container.
- switch external port to 9080, but keep Traefik's internal port as 80.
services:
reverse-proxy:
image: traefik:latest
command:
- --entrypoints.web.address=:80
ports:
- 9080:80
- put the whoami container behind /whoami url path.
whoami:
image: containous/whoami
container_name: whoami.docker.local
labels:
- traefik.enable=true
- traefik.http.routers.whoami.entrypoints=web,websecure
- traefik.http.routers.whoami.rule=HostRegexp(`whoami.docker.local`)"
- traefik.http.routers.whoami.rule=Path(`/whoami`)
- traefik.http.middlewares.whoami.stripprefix.prefixes=/whoami
- added HTTPS - file provider, certs volume, config volume, websecure entrypoint for 443, port map 9443:443.
services:
reverse-proxy:
image: traefik:latest
command:
# setup https entrypoint on port 9443
- --entrypoints.websecure.address=:443
ports:
# https port - backends to 443
- "9443:443"
This part is resulting in a 404 page not found
message with the following commands:
$ curl -k -H Host:whoami.docker.local https://127.0.0.1:9443/
404 page not found
$ curl -k -H Host:whoami.docker.local https://whoami.docker.local:9443/
404 page not found
I have run curl -v
also and found that Traefik is serving up my custom self-signed certificate, so that's good. Past that, I'm not sure what the deal is. I've got logging turned on, but there's nothing relevant to the 404
result in the logs.