traefik / whoami

Tiny Go server that prints os information and HTTP request to output

Home Page:https://traefik.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not reproduce Traefik quick start. Getting http 503 error

Twofyw opened this issue · comments

I'm following Traefik quick start and arrived at the following docker compose file:

version: '3'

services:
  traefik:
    image: traefik:v2.10
    restart: always
    command: --api.insecure=true --providers.docker
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  whoami:
    image: traefik/whoami
    labels:
      - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"

However it always give me http 503 error.

$ curl -v -H Host:whoami.docker.localhost http://127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host:whoami.docker.localhost
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< Content-Length: 0
< Date: Sat, 13 May 2023 10:43:50 GMT
<
* Connection #0 to host 127.0.0.1 left intact

I've tried to replace the service with python -m http.server using static config and it works. So I wonder if the 503 error is related to the whoami image.

Hello,

As you can see everything works well:

docker-compose.yml
version: '3'

services:
  traefik:
    image: traefik:v2.10
    restart: always
    command: --api.insecure=true --providers.docker
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  whoami:
    image: traefik/whoami:v1.9.0
    labels:
      - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
Run traefik
$ docker-compose up --remove-orphans
[+] Running 6/6
 ✔ traefik 4 layers [⣿⣿⣿⣿]      0B/0B      Pulled                                                                                                                        3.4s 
   ✔ f56be85fc22e Already exists                                                                                                                                         0.0s 
   ✔ d055169f9c6f Already exists                                                                                                                                         0.0s 
   ✔ 56d2f042306d Pull complete                                                                                                                                          1.7s 
   ✔ 06c7eaf9711b Pull complete                                                                                                                                          1.8s 
 ✔ whoami Pulled                                                                                                                                                         1.0s 
[+] Running 3/3
 ✔ Container foo_foo-bar              Removed                                                                                                                            0.0s 
 ✔ Container issue-traefik-whoami-1   Created                                                                                                                            0.1s 
 ✔ Container issue-traefik-traefik-1  Created                                                                                                                            0.1s 
Attaching to issue-traefik-traefik-1, issue-traefik-whoami-1
issue-traefik-whoami-1   | 2023/05/13 10:56:36 Starting up on port 80
issue-traefik-traefik-1  | time="2023-05-13T10:56:36Z" level=info msg="Configuration loaded from flags."
curl
$ curl -v -H Host:whoami.docker.localhost http://127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host:whoami.docker.localhost
> User-Agent: curl/8.0.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 366
< Content-Type: text/plain; charset=utf-8
< Date: Sat, 13 May 2023 10:56:55 GMT
< 
Hostname: 365aed5b8e52
IP: 127.0.0.1
IP: 172.18.0.2
RemoteAddr: 172.18.0.3:36806
GET / HTTP/1.1
Host: whoami.docker.localhost
User-Agent: curl/8.0.1
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.18.0.1
X-Forwarded-Host: whoami.docker.localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 38ec644d4bc2
X-Real-Ip: 172.18.0.1

* Connection #0 to host 127.0.0.1 left intact

Your problem is not related to whoami.

For help, please join our Community Forum and reach out to us on the Traefik v2 section.