traefik / whoami

Tiny Go server that prints os information and HTTP request to output
https://traefik.io
Apache License 2.0
1.04k stars 223 forks source link

`WHOAMI_PORT_NUMBER` has no effect #49

Closed chris-aeviator closed 2 years ago

chris-aeviator commented 2 years ago

running

version 3
services:
  fake-service:
    image: traefik/whoami
    environment:
      - 'WHOAMI_PORT_NUMBER=3993'

will still bring up

fake-service_1        | Starting up on port 80
ldez commented 2 years ago

Hello,

I think it's because you are not using the right version, I recommend using an explicit version because the management of the latest tag (no tag means latest) by Docker can be surprising.

version: '3.7'

services:
  fake-service:
    image: traefik/whoami:v1.7.1
    environment:
      - 'WHOAMI_PORT_NUMBER=3993'
$ docker-compose up
issue-traefik-fake-service-1  | 2022/01/08 14:00:18 Starting up on port 3993
DDzwiedziu commented 5 months ago

v1.10.2 and it still does not work:

 % docker-compose up
Recreating kanboard_kanboard_1 ... done
Starting kanboard_whoami_1     ... done
Attaching to kanboard_whoami_1, kanboard_kanboard_1
whoami_1    | 2024/06/25 11:02:39 Starting up on port 2001
version: '2'
services:
  kanboard:
    image: kanboard/kanboard:latest
    ports:
     - "8081:80"
     - "4443:443"
    volumes:
     - kanboard_data:/var/www/app/data
     - kanboard_plugins:/var/www/app/plugins
     - kanboard_ssl:/etc/nginx/ssl
    environment:
      - PLUGIN_INSTALLER=true
      # - WHOAMI_PORT_NUMBER=81
  whoami:
    # A container that exposes an API to show its IP address
    image: traefik/whoami:v1.10.2
    command:
      - --port=2001
      - --name=whoami_kanboard
    labels:
      - "traefik.http.routers.whoami.rule=Host(`kanboard.localhost`)"
      - "traefik.http.services.home.loadbalancer.server.port=8081"
volumes:
  kanboard_data:
    driver: local
  kanboard_plugins:
    driver: local
  kanboard_ssl:
    driver: local
/var/lib/docker/volumes/ docker container ls | egrep 'traefik|whoami'
f757fa3a77ce   traefik/whoami:v1.10.2          "/whoami --port=2001…"   16 seconds ago   Up 13 seconds         80/tcp                                                                                           kanboard_whoami_1
92b417382e59   traefik:v3.0                    "/entrypoint.sh --ap…"   40 minutes ago   Up 18 minutes         0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                     traefik_reverse-proxy_1

When using the env variable instead of the --port command it is ignored completley.

 % docker-compose up
Starting kanboard_kanboard_1 ... done
Starting kanboard_whoami_1   ... done
Attaching to kanboard_whoami_1, kanboard_kanboard_1
whoami_1    | 2024/06/25 11:04:20 Starting up on port 80

Changing the tag from empty to the given version does not change the behaviour.

mmatur commented 5 months ago

@DDzwiedziu I can confirm it is working with traefik/whoami:v1.10.2 docker image.

$ docker run --rm -e WHOAMI_PORT_NUMBER=1234 traefik/whoami:v1.10.2
Unable to find image 'traefik/whoami:v1.10.2' locally
v1.10.2: Pulling from traefik/whoami
Digest: sha256:1474027c316661cdec87df2623e13a41e7e1ce0ba99c24917631de8f300b5420
Status: Downloaded newer image for traefik/whoami:v1.10.2
2024/06/25 13:39:06 Starting up on port 1234