From 8010758b29ffc9682bac9df982d6def607efd059 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 19 Mar 2017 18:40:09 +0100 Subject: [PATCH] Docker: Added warning if network could not be found (#1310) * Added warning if network could not be found * Removed regex import from master * Corrected wrong function call --- docs/toml.md | 2 +- provider/docker.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/toml.md b/docs/toml.md index edde70544..a80c12187 100644 --- a/docs/toml.md +++ b/docs/toml.md @@ -816,7 +816,7 @@ Labels can be used on containers to override default behaviour: - `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend. - `traefik.frontend.priority=10`: override default frontend priority - `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`. -- `traefik.docker.network`: Set the docker network to use for connections to this container +- `traefik.docker.network`: Set the docker network to use for connections to this container. If a container is linked to several networks, be sure to set the proper network name (you can check with docker inspect ) otherwise it will randomly pick one (depending on how docker is returning them). For instance when deploying docker `stack` from compose files, the compose defined networks will be prefixed with the `stack` name. NB: when running inside a container, Træfɪk will need network access through `docker network connect ` diff --git a/provider/docker.go b/provider/docker.go index 4b182a917..62cff1c80 100644 --- a/provider/docker.go +++ b/provider/docker.go @@ -412,6 +412,8 @@ func (provider *Docker) getIPAddress(container dockerData) string { if network != nil { return network.Addr } + + log.Warnf("Could not find network named '%s' for container '%s'! Maybe you're missing the project's prefix in the label? Defaulting to first available network.", label, container.Name) } }