Unable to connect to dashboard on port 8080

Hello,

I'm using Traefik for the first time and have tried to install Traefik version 2.11. I also wanted to activate the dashboard to get a better overview. I can't get the dashboard to run on port 8080. Every time I try, I get the message that port 8080 is already in use. However, the port is free, as confirmed by both docker ps and netstat. I have now changed the port to 8081, and then I can access the dashboard. Now both entry points are displayed, even though 8080 is not configured. Before changing the port, I deleted all containers, ran a docker system prune, and restarted the VPS. Does anyone have an idea what I'm doing wrong?

docker-compose.yml

---
# -- (Optional) When using a custom network
# networks:
#   your-traefik-network:
#     external: true
services:
  traefik:
    image: traefik:v2.11.0
    container_name: traefik
    ports:
      - 80:80
      - 443:443
      # -- (Optional) Enable Dashboard, don't do in production
      - 8081:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./config/traefik.yml:/etc/traefik/traefik.yml:ro
      - ./letsencrypt:/letsencrypt
      - ./logs/:/var/log/traefik/traefik.log
    # -- (Optional) When using Cloudflare as Cert Resolver
    # environment:
    #   - CF_DNS_API_TOKEN=your-cloudflare-api-token
    # -- (Optional) When using a custom network
    # networks:
    #   - your-traefik-network
    restart: unless-stopped

traefik.yml

global:
  checkNewVersion: true
  sendAnonymousUsage: true

# -- (Optional) Change Log Level and Format here...
#     - loglevels [DEBUG, INFO, WARNING, ERROR, CRITICAL]
#     - format [common, json, logfmt]
log:
  level: DEBUG
  format: common
  filePath: /var/log/traefik/traefik.log

# -- (Optional) Enable Accesslog and change Format here...
#     - format [common, json, logfmt]
# accesslog:
#   format: common
#   filePath: /var/log/traefik/access.log

# -- (Optional) Enable API and Dashboard here, don't do in production
api:
  dashboard: true
  insecure: true

# -- Change EntryPoints here...
entryPoints:
  web:
    address: :80
    # -- (Optional) Redirect all HTTP to HTTPS
    # http:
    #   redirections:
    #     entryPoint:
    #       to: websecure
    #       scheme: https
  websecure:
    address: :443
  # -- (Optional) Add custom Entrypoint
  custom:
    address: :8081


# -- Configure your CertificateResolver here...
# certificatesResolvers:
staging:
  acme:
    email: email@host.com
    storage: /letsencrypt/acme.json
    caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
#       -- (Optional) Remove this section, when using DNS Challenge
    httpChallenge:
      entryPoint: web
#       -- (Optional) Configure DNS Challenge
#       dnsChallenge:
#         provider: your-resolver (e.g. cloudflare)
#         resolvers:
#           - "1.1.1.1:53"
#           - "8.8.8.8:53"
production:
  acme:
    email: email@host.com
    storage: /letsencrypt/acme.json
    caServer: "https://acme-v02.api.letsencrypt.org/directory"
#       -- (Optional) Remove this section, when using DNS Challenge
    httpChallenge:
      entryPoint: web
#       -- (Optional) Configure DNS Challenge
#       dnsChallenge:
#         provider: your-resolver (e.g. cloudflare)
#         resolvers:
#           - "1.1.1.1:53"
#           - "8.8.8.8:53"

# -- (Optional) Disable TLS Cert verification check
# serversTransport:
#   insecureSkipVerify: true

# -- (Optional) Overwrite Default Certificates
# tls:
#   stores:
#     default:
#       defaultCertificate:
#         certFile: /etc/traefik/certs/cert.pem
#         keyFile: /etc/traefik/certs/cert-key.pem
# -- (Optional) Disable TLS version 1.0 and 1.1
#   options:
#     default:
#       minVersion: VersionTLS12

providers:
  docker:
    # -- (Optional) Enable this, if you want to expose all containers automatically
    exposedByDefault: false
  file:
    directory: /etc/traefik/
    watch: true

docker ps

NAMES             IMAGE                    CONTAINER ID   SIZE                     NETWORKS                  PORTS
traefik           traefik:v2.11.0          646e22d12fa9   0B (virtual 159MB)       traefik_default           0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp
portainer_agent   portainer/agent:2.19.4   993c55c61473   2.73kB (virtual 212MB)   portainer-agent_default   0.0.0.0:9001->9001/tcp, :::9001->9001/tcp

traefik log

traefik  | 2024/03/03 14:05:23 traefik.go:80: command traefik error: error while building entryPoint traefik: error preparing server: error opening listener: listen tcp :8080: bind: address already in use
traefik exited with code 0

enables Traefik dashboard on internal port 8080.

You map it to external container port 8081:

    ports:
      - 80:80
      - 443:443
      # -- (Optional) Enable Dashboard, don't do in production
      - 8081:8080

so it’s available at URL:

http://example.com:8081/dashboard/

You also create an internal Traefik entrypoint on port 8081, which has no effect on dashboard:

  custom:
    address: :8081

Check simple Traefik example how to access dashboard on regular https entrypoint.


Regarding used port 8080 on host, try:

docker run -p 8080:80 traefik/whoami

Thank you very much for your help.

The docker run command does not work as well. Same message, the port is already in use.
And again I have checked docker ps and netstat. Both show no port assignment for 8080.

I dont get it where the port assignment is coming from. I will erase the VPS and try it again.

Thanks for your help!

Did you run sudo netstat -tulpn?

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