Skip to content

Commit

Permalink
Docker: Added warning if network could not be found (#1310)
Browse files Browse the repository at this point in the history
* Added warning if network could not be found

* Removed regex import from master

* Corrected wrong function call
  • Loading branch information
zweizeichen authored and emilevauge committed Apr 4, 2017
1 parent 1e492a2 commit ac57d92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <container_id>) 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.<service-name>.port=443`: create a service binding with frontend/backend using this port. Overrides `traefik.port`.
Expand Down
2 changes: 2 additions & 0 deletions provider/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit ac57d92

Please sign in to comment.