Previously, I was using nginx where a codesample like this would work fine:
http://api:80/whatever
however recently i have switched to traefik, and now im having issues
name: steal
services:
api:
build: ./Docker/steal/api
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`localhost`)"
- "traefik.http.services.api.loadbalancer.server.port=8080"
depends_on:
mongo:
condition: service_healthy
restart: always
healthcheck:
test: [ "CMD", "curl", "-f", "http://api:8080/status" ]
interval: 10s
timeout: 15s
retries: 3
start_period: 10s
discord:
build: ./Docker/steal/discord
depends_on:
traefik:
condition: service_healthy
traefik:
image: traefik:latest
container_name: traefik
command:
- /bin/sh
- -c
- |
apk add --no-cache curl &&
traefik --api.insecure=true --providers.docker=true --entrypoints.web.address=:80 --providers.docker.exposedbydefault=false
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
healthcheck:
test: [ "CMD", "curl", "-f", "http://traefik:8080/api/rawdata" ]
interval: 10s
timeout: 15s
retries: 3
start_period: 10s
I have tried http://api:80
, http://localhost:80
, http://localhost
, etc and still haven’t been able to connect. The message i receive is ” All connection attempts failed”
Any idea how I can fix this? I know its probably some small traefik setting I am overlooking, but any help is appreciated
3