Been using docker for a while now and have now switched to docker-compose and have been using traefik to access Nextcloud on my local server from external locations. This was working fine (with some help from this community ), but when I added another container (ombi) to be exposed externally via traefik, I only get a "502 Bad Gateway" error, despite having the exact same configuration. I tried using only the new container, in case a duplicate load-balancer port is not allowed but still the same.
Here is the relevant snippet of my docker-compose.yml (the remainder being containers not exposed via traefik):
version: '3'
networks:
proxy:
external: true
traefik:
image: traefik:v2.0.4
container_name: traefik
restart: unless-stopped
networks:
- proxy
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/traefik/acme.json:/acme.json
- /opt/traefik/traefik.yml:/traefik.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik.domain.net`)"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.domain.net`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=http"
- "traefik.http.routers.traefik-secure.service=api@internal"
whoami:
image: "containous/whoami"
container_name: "simple-whoami"
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.domain.net`)"
- "traefik.http.routers.whoami.entrypoints=https"
- "traefik.http.routers.whoami.tls.certresolver=http"
ombi:
image: linuxserver/ombi
container_name: ombi
networks:
- proxy
environment:
- PUID=1001
- PGID=1001
- TZ=Europe/Berlin
volumes:
- /opt/ombi:/config
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.ombi-secure.entrypoints=https"
- "traefik.http.routers.ombi-secure.rule=Host(`ombi.domain.net`)"
- "traefik.http.routers.ombi-secure.tls=true"
- "traefik.http.routers.ombi-secure.tls.certresolver=http"
- "traefik.http.routers.ombi-secure.service=ombi"
- "traefik.http.routers.ombi.entrypoints=http"
- "traefik.http.routers.ombi.rule=Host(`ombi.domain.net`)"
- "traefik.http.middlewares.ombi-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.ombi.middlewares=ombi-https-redirect"
- "traefik.http.services.ombi.loadbalancer.server.port=443"
- "traefik.http.services.ombi.loadbalancer.server.scheme=https"
nextcloud:
image: linuxserver/nextcloud
container_name: nextcloud
networks:
- proxy
environment:
- PUID=1001
- PGID=1001
- TZ=Europe/Berlin
volumes:
- /opt/nextcloud:/config
- /opt/nextcloud_data:/data
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.nextcloud-secure.entrypoints=https"
- "traefik.http.routers.nextcloud-secure.rule=Host(`nextcloud.domain.net`)"
- "traefik.http.routers.nextcloud-secure.tls=true"
- "traefik.http.routers.nextcloud-secure.tls.certresolver=http"
- "traefik.http.routers.nextcloud-secure.service=nextcloud"
- "traefik.http.services.nextcloud.loadbalancer.server.port=443"
- "traefik.http.services.nextcloud.loadbalancer.server.scheme=https"
- "traefik.http.routers.nextcloud.entrypoints=http"
- "traefik.http.routers.nextcloud.rule=Host(`nextcloud.domain.net`)"
- "traefik.http.middlewares.nextcloud-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.nextcloud.middlewares=nextcloud-https-redirect"
traefik.yml:
api:
dashboard: true
log:
level: DEBUG
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
network: proxy
certificatesResolvers:
http:
acme:
email: name@gmail.com
storage: acme.json
httpChallenge:
entryPoint: http
serversTransport:
insecureSkipVerify: true
Part of log:
traefik | time="2019-11-20T10:50:31Z" level=debug msg="vulcand/oxy/roundrobin/rr: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/2.0\",\"ProtoMajor\":2,\"ProtoMinor\":0,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.58.0\"],\"X-Forwarded-Host\":[\"ombi.domain.net\"],\"X-Forwarded-Port\":[\"443\"],\"X-Forwarded-Proto\":[\"https\"],\"X-Forwarded-Server\":[\"c6e63aeff7e6\"],\"X-Real-Ip\":[\"1.2.3.4\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"ombi.domain.net\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"1.2.3.4:42966\",\"RequestURI\":\"/\",\"TLS\":null}"
Any ideas? I am surely missing something stupid...