Traefik "standalone" with Docker backend

Hi,

I posted an issue (https://github.com/containous/traefik/issues/6635) on github repo but the bot redirected me there.
All details are in the issue linked, but let me summary the issue :

I've installed traefik (v2.2) as a standalone application and configured Docker as a provider.
It doesn't work as expected ; some things are correctly detected (container ip, service name...), some are not (container exposed port).

If I run traefik as a docker container, it works well.

I expected traefik working "outside" my infrastructure (Docker) like the README/Overview tell:

Does I miss-configured something?

Thanks,

Regards.

Hello,

I think that your issue is related to how Docker for Mac works.

Hi @ldez,

I've just installed an Ubuntu (18.04.4 LTS).
I've done the same (get traefik from github release page), installed docker (from official repos).
The problem is the same

So where I really should address this issue?

Thanks,

Regards.

test@test-virtual-machine:~/tests$ sudo ./traefik --configFile=config/traefik.toml
INFO[0000] Configuration loaded from file: /home/test/tests/config/traefik.toml 
INFO[2020-04-05T17:46:36+02:00] Traefik version 2.2.0 built on 2020-03-25T17:32:57Z 
DEBU[2020-04-05T17:46:36+02:00] Static configuration loaded {"global":{"checkNewVersion":true,"sendAnonymousUsage":true},"serversTransport":{"maxIdleConnsPerHost":200},"entryPoints":{"traefik":{"address":":8080","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}},"web":{"address":":80","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}},"websecure":{"address":":443","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}}},"providers":{"providersThrottleDuration":2000000000,"docker":{"watch":true,"endpoint":"unix:///var/run/docker.sock","defaultRule":"Host(`{{ normalize .Name }}.localhost`)","exposedByDefault":true,"swarmModeRefreshSeconds":15000000000},"file":{"directory":"/home/test/tests/config/traefik.d/","watch":true}},"api":{"insecure":true,"dashboard":true},"ping":{"entryPoint":"traefik"},"log":{"level":"DEBUG","format":"common"},"accessLog":{"filePath":"/usr/local/var/log/traefik.log","format":"common","filters":{},"fields":{"defaultMode":"keep","headers":{"defaultMode":"drop"}}}} 
INFO[2020-04-05T17:46:36+02:00] Stats collection is enabled.                 
INFO[2020-04-05T17:46:36+02:00] Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration. 
INFO[2020-04-05T17:46:36+02:00] Help us improve Traefik by leaving this feature on :) 
INFO[2020-04-05T17:46:36+02:00] More details on: https://docs.traefik.io/contributing/data-collection/ 
INFO[2020-04-05T17:46:36+02:00] Starting provider aggregator.ProviderAggregator {} 
DEBU[2020-04-05T17:46:36+02:00] Start TCP Server                              entryPointName=traefik
DEBU[2020-04-05T17:46:36+02:00] Start TCP Server                              entryPointName=websecure
DEBU[2020-04-05T17:46:36+02:00] Start TCP Server                              entryPointName=web
INFO[2020-04-05T17:46:36+02:00] Starting provider *file.Provider {"directory":"/home/test/tests/config/traefik.d/","watch":true} 
INFO[2020-04-05T17:46:36+02:00] Starting provider *traefik.Provider {}       
DEBU[2020-04-05T17:46:36+02:00] Configuration received from provider file: {"http":{"routers":{"dashboard":{"service":"api@internal","rule":"Host(`traefik.localhost`)"}}},"tcp":{},"udp":{},"tls":{}}  providerName=file
DEBU[2020-04-05T17:46:36+02:00] Configuration received from provider internal: {"http":{"routers":{"api":{"entryPoints":["traefik"],"service":"api@internal","rule":"PathPrefix(`/api`)","priority":2147483646},"dashboard":{"entryPoints":["traefik"],"middlewares":["dashboard_redirect@internal","dashboard_stripprefix@internal"],"service":"dashboard@internal","rule":"PathPrefix(`/`)","priority":2147483645},"ping":{"entryPoints":["traefik"],"service":"ping@internal","rule":"PathPrefix(`/ping`)","priority":2147483647}},"services":{"api":{},"dashboard":{},"noop":{},"ping":{}},"middlewares":{"dashboard_redirect":{"redirectRegex":{"regex":"^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$","replacement":"${1}/dashboard/","permanent":true}},"dashboard_stripprefix":{"stripPrefix":{"prefixes":["/dashboard/","/dashboard"]}}}},"tcp":{},"tls":{}}  providerName=internal
DEBU[2020-04-05T17:46:36+02:00] No entryPoint defined for this router, using the default one(s) instead: [web websecure]  routerName=dashboard
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware api@internal  entryPointName=web routerName=dashboard@file middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareType=Recovery entryPointName=web middlewareName=traefik-internal-recovery
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=websecure
DEBU[2020-04-05T17:46:36+02:00] No default certificate, generating one       
INFO[2020-04-05T17:46:36+02:00] Starting provider *docker.Provider {"watch":true,"endpoint":"unix:///var/run/docker.sock","defaultRule":"Host(`{{ normalize .Name }}.localhost`)","exposedByDefault":true,"swarmModeRefreshSeconds":15000000000} 
DEBU[2020-04-05T17:46:36+02:00] Provider connection established with docker 19.03.8 (API 1.40)  providerName=docker
DEBU[2020-04-05T17:46:36+02:00] Configuration received from provider docker: {"http":{"routers":{"swagger":{"entryPoints":["web"],"service":"swagger-tests","rule":"Host(`swagger-editor.localhost`)"}},"services":{"swagger-tests":{"loadBalancer":{"servers":[{"url":"http://172.18.0.2:80"}],"passHostHeader":true}}}},"tcp":{},"udp":{}}  providerName=docker
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware api@internal  entryPointName=traefik routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware dashboard@internal  entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix
DEBU[2020-04-05T17:46:36+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
DEBU[2020-04-05T17:46:36+02:00] Setting up redirection from ^(http:\/\/[^:\/]+(:\d+)?)\/$ to ${1}/dashboard/  routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
DEBU[2020-04-05T17:46:36+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware ping@internal  entryPointName=traefik routerName=ping@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareType=Recovery entryPointName=traefik middlewareName=traefik-internal-recovery
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware api@internal  middlewareName=tracing middlewareType=TracingForwarder entryPointName=web routerName=dashboard@file
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=web
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=websecure middlewareType=Recovery middlewareName=traefik-internal-recovery
DEBU[2020-04-05T17:46:36+02:00] No default certificate, generating one       
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware dashboard@internal  entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix entryPointName=traefik
DEBU[2020-04-05T17:46:36+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareName=dashboard_redirect@internal entryPointName=traefik routerName=dashboard@internal middlewareType=RedirectRegex
DEBU[2020-04-05T17:46:36+02:00] Setting up redirection from ^(http:\/\/[^:\/]+(:\d+)?)\/$ to ${1}/dashboard/  middlewareName=dashboard_redirect@internal entryPointName=traefik routerName=dashboard@internal middlewareType=RedirectRegex
DEBU[2020-04-05T17:46:36+02:00] Adding tracing to middleware                  routerName=dashboard@internal entryPointName=traefik middlewareName=dashboard_redirect@internal
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware ping@internal  entryPointName=traefik routerName=ping@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware api@internal  entryPointName=traefik routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           middlewareType=Pipelining entryPointName=web routerName=swagger@docker serviceName=swagger-tests middlewareName=pipelining
DEBU[2020-04-05T17:46:36+02:00] Creating load-balancer                        entryPointName=web routerName=swagger@docker serviceName=swagger-tests
DEBU[2020-04-05T17:46:36+02:00] Creating server 0 http://172.18.0.2:80        serviceName=swagger-tests entryPointName=web routerName=swagger@docker serverName=0
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware swagger-tests  entryPointName=web routerName=swagger@docker middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T17:46:36+02:00] Added outgoing tracing middleware api@internal  routerName=dashboard@file middlewareName=tracing middlewareType=TracingForwarder entryPointName=web
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=web middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T17:46:36+02:00] Creating middleware                           entryPointName=websecure middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T17:46:36+02:00] No default certificate, generating one       
DEBU[2020-04-05T17:46:48+02:00] vulcand/oxy/roundrobin/rr: begin ServeHttp on request  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Accept-Language\":[\"fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\"],\"Cache-Control\":[\"max-age=0\"],\"Connection\":[\"keep-alive\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"test-virtual-machine\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:52870\",\"RequestURI\":\"/\",\"TLS\":null}"
DEBU[2020-04-05T17:46:48+02:00] vulcand/oxy/roundrobin/rr: Forwarding this request to URL  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Accept-Language\":[\"fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\"],\"Cache-Control\":[\"max-age=0\"],\"Connection\":[\"keep-alive\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"test-virtual-machine\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:52870\",\"RequestURI\":\"/\",\"TLS\":null}" ForwardURL="http://172.18.0.2:80"
DEBU[2020-04-05T17:46:48+02:00] '502 Bad Gateway' caused by: dial tcp 172.18.0.2:80: connect: connection refused 
DEBU[2020-04-05T17:46:48+02:00] vulcand/oxy/roundrobin/rr: completed ServeHttp on request  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Accept-Language\":[\"fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\"],\"Cache-Control\":[\"max-age=0\"],\"Connection\":[\"keep-alive\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"test-virtual-machine\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:52870\",\"RequestURI\":\"/\",\"TLS\":null}"

I used your files and I don't reproduce on Linux:

docker-compose.yml
version: "3.7"

services:
  swagger:
    image: swaggerapi/swagger-editor
    labels:
      - traefik.http.routers.swagger.rule=Host(`swagger-editor.localhost`)
      - traefik.http.routers.swagger.entrypoints=web
      - traefik.http.services.swagger.loadbalancer.server.port=8080
dyn.toml
[http.routers.dashboard]
  rule = "Host(`traefik.localhost`)"
  entryPoint = "web"
  service = "api@internal"
traefik.toml
[entryPoints]
  [entryPoints.web]
    address = ":80"

  [entryPoints.websecure]
    address = ":443"

[log]
  level = "DEBUG"

[api]
  insecure = true

[providers.docker]
  defaultRule = "Host(`{{ normalize .Name }}.localhost`)"
  exposedByDefault = true

[providers.file]
  filename = "./dyn.toml"
logs
$ sudo ./traefik 
INFO[0000] Configuration loaded from file: /home/ldez/sources/go/src/github.com/containous/traefik/traefik.toml 
INFO[2020-04-05T18:10:35+02:00] Traefik version dev built on I don't remember exactly 
DEBU[2020-04-05T18:10:35+02:00] Static configuration loaded {"global":{"checkNewVersion":true},"serversTransport":{"maxIdleConnsPerHost":200},"entryPoints":{"traefik":{"address":":8080","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}},"web":{"address":":80","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}},"websecure":{"address":":443","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{},"http":{}}},"providers":{"providersThrottleDuration":2000000000,"docker":{"watch":true,"endpoint":"unix:///var/run/docker.sock","defaultRule":"Host(`{{ normalize .Name }}.localhost`)","exposedByDefault":true,"swarmModeRefreshSeconds":15000000000},"file":{"watch":true,"filename":"./dyn.toml"}},"api":{"insecure":true,"dashboard":true},"log":{"level":"DEBUG","format":"common"}} 
INFO[2020-04-05T18:10:35+02:00] 
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://docs.traefik.io/contributing/data-collection/ 
INFO[2020-04-05T18:10:35+02:00] Starting provider aggregator.ProviderAggregator {} 
DEBU[2020-04-05T18:10:35+02:00] Start TCP Server                              entryPointName=web
DEBU[2020-04-05T18:10:35+02:00] Start TCP Server                              entryPointName=traefik
DEBU[2020-04-05T18:10:35+02:00] Start TCP Server                              entryPointName=websecure
INFO[2020-04-05T18:10:35+02:00] Starting provider *file.Provider {"watch":true,"filename":"./dyn.toml"} 
INFO[2020-04-05T18:10:35+02:00] Starting provider *traefik.Provider {}       
INFO[2020-04-05T18:10:35+02:00] Starting provider *docker.Provider {"watch":true,"endpoint":"unix:///var/run/docker.sock","defaultRule":"Host(`{{ normalize .Name }}.localhost`)","exposedByDefault":true,"swarmModeRefreshSeconds":15000000000} 
DEBU[2020-04-05T18:10:35+02:00] Configuration received from provider file: {"http":{"routers":{"dashboard":{"service":"api@internal","rule":"Host(`traefik.localhost`)"}}},"tcp":{},"udp":{},"tls":{}}  providerName=file
DEBU[2020-04-05T18:10:35+02:00] No entryPoint defined for this router, using the default one(s) instead: [web websecure]  routerName=dashboard
DEBU[2020-04-05T18:10:35+02:00] Configuration received from provider internal: {"http":{"routers":{"api":{"entryPoints":["traefik"],"service":"api@internal","rule":"PathPrefix(`/api`)","priority":2147483646},"dashboard":{"entryPoints":["traefik"],"middlewares":["dashboard_redirect@internal","dashboard_stripprefix@internal"],"service":"dashboard@internal","rule":"PathPrefix(`/`)","priority":2147483645}},"services":{"api":{},"dashboard":{},"noop":{}},"middlewares":{"dashboard_redirect":{"redirectRegex":{"regex":"^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$","replacement":"${1}/dashboard/","permanent":true}},"dashboard_stripprefix":{"stripPrefix":{"prefixes":["/dashboard/","/dashboard"]}}}},"tcp":{},"tls":{}}  providerName=internal
DEBU[2020-04-05T18:10:35+02:00] Added outgoing tracing middleware api@internal  middlewareType=TracingForwarder middlewareName=tracing entryPointName=web routerName=dashboard@file
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           middlewareType=Recovery entryPointName=web middlewareName=traefik-internal-recovery
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           entryPointName=websecure middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T18:10:35+02:00] No default certificate, generating one       
DEBU[2020-04-05T18:10:35+02:00] Provider connection established with docker 19.03.8-ce (API 1.40)  providerName=docker
DEBU[2020-04-05T18:10:35+02:00] Configuration received from provider docker: {"http":{"routers":{"swagger":{"entryPoints":["web"],"service":"swagger","rule":"Host(`swagger-editor.localhost`)"}},"services":{"swagger":{"loadBalancer":{"servers":[{"url":"http://192.168.96.2:8080"}],"passHostHeader":true}}}},"tcp":{},"udp":{}}  providerName=docker
DEBU[2020-04-05T18:10:35+02:00] Added outgoing tracing middleware api@internal  middlewareType=TracingForwarder routerName=dashboard@file entryPointName=websecure middlewareName=tracing
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           entryPointName=websecure middlewareType=Recovery middlewareName=traefik-internal-recovery
DEBU[2020-04-05T18:10:35+02:00] Added outgoing tracing middleware api@internal  routerName=api@internal entryPointName=traefik middlewareName=tracing middlewareType=TracingForwarder
DEBU[2020-04-05T18:10:35+02:00] Added outgoing tracing middleware dashboard@internal  middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik routerName=dashboard@internal
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           middlewareType=StripPrefix entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
DEBU[2020-04-05T18:10:35+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal
DEBU[2020-04-05T18:10:35+02:00] Setting up redirection from ^(http:\/\/[^:\/]+(:\d+)?)\/$ to ${1}/dashboard/  middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
DEBU[2020-04-05T18:10:35+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T18:10:35+02:00] Creating middleware                           entryPointName=web middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T18:10:35+02:00] No default certificate, generating one       
DEBU[2020-04-05T18:10:36+02:00] Added outgoing tracing middleware dashboard@internal  middlewareType=TracingForwarder entryPointName=traefik routerName=dashboard@internal middlewareName=tracing
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix entryPointName=traefik
DEBU[2020-04-05T18:10:36+02:00] Adding tracing to middleware                  entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
DEBU[2020-04-05T18:10:36+02:00] Setting up redirection from ^(http:\/\/[^:\/]+(:\d+)?)\/$ to ${1}/dashboard/  routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
DEBU[2020-04-05T18:10:36+02:00] Adding tracing to middleware                  middlewareName=dashboard_redirect@internal routerName=dashboard@internal entryPointName=traefik
DEBU[2020-04-05T18:10:36+02:00] Added outgoing tracing middleware api@internal  middlewareType=TracingForwarder entryPointName=traefik routerName=api@internal middlewareName=tracing
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
DEBU[2020-04-05T18:10:36+02:00] Added outgoing tracing middleware api@internal  entryPointName=web routerName=dashboard@file middlewareType=TracingForwarder middlewareName=tracing
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           middlewareName=pipelining middlewareType=Pipelining routerName=swagger@docker serviceName=swagger entryPointName=web
DEBU[2020-04-05T18:10:36+02:00] Creating load-balancer                        entryPointName=web routerName=swagger@docker serviceName=swagger
DEBU[2020-04-05T18:10:36+02:00] Creating server 0 http://192.168.96.2:8080    routerName=swagger@docker serviceName=swagger serverName=0 entryPointName=web
DEBU[2020-04-05T18:10:36+02:00] Added outgoing tracing middleware swagger     routerName=swagger@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=web
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           middlewareName=traefik-internal-recovery entryPointName=web middlewareType=Recovery
DEBU[2020-04-05T18:10:36+02:00] Creating middleware                           middlewareType=Recovery entryPointName=websecure middlewareName=traefik-internal-recovery
DEBU[2020-04-05T18:10:36+02:00] No default certificate, generating one       
DEBU[2020-04-05T18:10:47+02:00] vulcand/oxy/roundrobin/rr: begin ServeHttp on request  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.69.1\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"containous-pc\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:51326\",\"RequestURI\":\"/\",\"TLS\":null}"
DEBU[2020-04-05T18:10:47+02:00] vulcand/oxy/roundrobin/rr: Forwarding this request to URL  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.69.1\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"containous-pc\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:51326\",\"RequestURI\":\"/\",\"TLS\":null}" ForwardURL="http://192.168.96.2:8080"
DEBU[2020-04-05T18:10:47+02:00] vulcand/oxy/roundrobin/rr: completed ServeHttp on request  Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.69.1\"],\"X-Forwarded-Host\":[\"swagger-editor.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"containous-pc\"],\"X-Real-Ip\":[\"127.0.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"swagger-editor.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"127.0.0.1:51326\",\"RequestURI\":\"/\",\"TLS\":null}"

curl
$ curl -H Host:swagger-editor.localhost http://127.0.0.1:80/
<!DOCTYPE html>
<!-- HTML for static distribution bundle build -->
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Swagger Editor</title>
  <style>
  * {
    box-sizing: border-box;
  }
  body {
    font-family: Roboto,sans-serif;
    font-size: 9px;
    line-height: 1.42857143;
    color: #444;
    margin: 0px;
  }

  #swagger-editor {
    font-size: 1.3em;
  }

  .container {
    height: 100%;
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
  }

  #editor-wrapper {
    height: 100%;
    border:1em solid #000;
    border:none;
  }

  .Pane2 {
    overflow-y: scroll;
  }

  </style>
  <link href="./dist/swagger-editor.css" rel="stylesheet">
  <link rel="icon" type="image/png" href="./dist/favicon-32x32.png" sizes="32x32" />
  <link rel="icon" type="image/png" href="./dist/favicon-16x16.png" sizes="16x16" />
</head>

<body>
  <div id="swagger-editor"></div>
  <script src="./dist/swagger-editor-bundle.js"> </script>
  <script src="./dist/swagger-editor-standalone-preset.js"> </script>
  <script>
  window.onload = function() {
    // Build a system
    const editor = SwaggerEditorBundle({
      dom_id: '#swagger-editor',
      layout: 'StandaloneLayout',
      presets: [
        SwaggerEditorStandalonePreset
      ]
    })

    window.editor = editor
  }
  </script>

  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
    <defs>
      <symbol viewBox="0 0 20 20" id="unlocked">
            <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
      </symbol>

      <symbol viewBox="0 0 20 20" id="locked">
        <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
      </symbol>

      <symbol viewBox="0 0 20 20" id="close">
        <path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
      </symbol>

      <symbol viewBox="0 0 20 20" id="large-arrow">
        <path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
      </symbol>

      <symbol viewBox="0 0 20 20" id="large-arrow-down">
        <path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
      </symbol>

Ok, my bad, I was relying on "port discovery" and disabled this line on the vm (because there is only this port exposed in the swagger image)
After forcing it I confirm it works.

Anyway, I looked after Docker for Mac / Docker for Linux.
I think this page give some answers: https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds

Thanks for your help @ldez