How do I use port in traefik binary not in docker

traefik.tml

[global]
  checkNewVersion = true
  sendAnonymousUsage = true

[entryPoints]
  [entryPoints.web]
    address = ":8282"

[log]


[api]
  insecure = true

[ping]

[providers.docker]
  endpoint = "unix:///home/malvee/.docker/desktop/docker.sock"


docker-compose.yaml
Running a simple ngnix hello world I just want to access this.

version: "3.8"
name: "apps"
services:
  my-nginx:
    image: nginx:latest
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.my-nginx-router.entrypoints=web"
      - "traefik.http.services.my-nginx-service.loadbalancer.server.port=80" # Specify the container's port

traefik dashbaod is working fine. I am running traefik from the binrary directly using
./traefik

but when I go to localhost:8282 nothing shows up

same on my host ip locally

idk what's the issue

It usually doesn’t work that way. Traefik needs to connect to the target Docker services. So it needs to have access to the IPs/ports. You probably don’t want to expose the ports on host, as that could circumvent any security middlewares.

Instead you should have Traefik and target services within Docker, with a shared Docker network. Check simple Traefik example.

I see, my main goal it to run the traefik from binary directly not from docker. and have servicse run in docker and test. so I can change code in traefik & build binary to test.

You could build and test inside a container.

Potentially you can even just bind-mount the binary (folder) into a container, so you don’t need to re-build the image.

But also building an image should be quick, if you just copy the binary as last step into the container.

I ran your example docker compose that you gave me and visited http://whoami.example.com/
it's not working gives no response

seems like there is tools to build image directly from code. no need to worry about binary.
Thanks btw

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.