From a73fee50dcdc16cf8e303fbf8818e6cd34382c81 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 0972ff3cd..f1941143c 100644 --- a/docs/toml.md +++ b/docs/toml.md @@ -844,7 +844,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. If several ports need to be exposed from a container, the services labels can be used - `traefik..port=443`: create a service binding with frontend/backend using this port. Overrides `traefik.port`. diff --git a/provider/docker.go b/provider/docker.go index 9cc57b17d..4d15c4faa 100644 --- a/provider/docker.go +++ b/provider/docker.go @@ -550,6 +550,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) } }