'can't bind to port 8080 with traefik's dashboard

I have the following traefik config file:

debug = true
logLevel = "DEBUG"

[entryPoints]
  [entryPoints.http]
    address = ":80"
    compress = true

  [entryPoints.dashboard]
    address=":81"
    [entryPoints.dashboard.auth]
      [entryPoints.dashboard.auth.basic]
        users = [
          "admin:-------"
        ]

[traefikLog]

[accessLog]

[api]
dashboard = true
entryPoint = "dashboard"

[ping]

[docker]

and the following routing in docker-compose:

- ‘5080:80’
- ‘5443:443’
- ‘5000:81’

this works as exepected and the dashboard is accessible from the outside on port 5000.

The problem arises when I change the dashboard port to 8080 and reflect it in the mapping ('5000:8080')

I get the following errors:

level=error msg="Error opening listener listen tcp :8080: bind: address already in use" 
level=fatal msg="Error preparing server: listen tcp :8080: bind: address already in use" 

The problem is that I don't see 8080 being in use:

[root@ns3106050 ~]# lsof -i -P -n | grep LISTEN
sshd      1276   root    3u  IPv4    515      0t0  TCP *:22 (LISTEN)
sshd      1276   root    4u  IPv6    517      0t0  TCP *:22 (LISTEN)
dockerd   1277   root    6u  IPv6   5955      0t0  TCP *:2376 (LISTEN)
docker-pr 5425   root    4u  IPv6  24484      0t0  TCP *:5443 (LISTEN)
docker-pr 5436   root    4u  IPv6  24492      0t0  TCP *:5000 (LISTEN)
docker-pr 5447   root    4u  IPv6  22391      0t0  TCP *:5080 (LISTEN)

what could I have missed?



Solution 1:[1]

Make sure you don't have --api flag specified for traefik command in docker-compose file. CLI and toml configurations don't work together.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 German Lashevich