-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker: Added warning if network could not be found #1310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question from someone who's barely familiar with the Docker integration: would it theoretically be possible to detect the multiple network situation, find the correct prefix, and insert it automatically?
I'm not saying this PR should or should not adjusted if it turns out we can act more intelligently. Just wondering if we can convert a warning asking for user actions into an automatism.
provider/docker.go
Outdated
@@ -6,6 +6,7 @@ import ( | |||
"math" | |||
"net" | |||
"net/http" | |||
"regexp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove this line. The CI doesn't like unused imports. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that one slipped through from master ;)
provider/docker.go
Outdated
@@ -412,6 +413,8 @@ func (provider *Docker) getIPAddress(container dockerData) string { | |||
if network != nil { | |||
return network.Addr | |||
} | |||
|
|||
log.Warn("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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be Warnf
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I always mix those up
Closes #1156. |
We could try to detect if the instance of traefik runs under a prefix and then could try to find the missing network by prepending the prefix. If you both have a network EDIT: I just looked up the situation on my box and the containers get the label |
@zweizeichen definitely sounds like a more sophisticated solution will take some time. Agree we should get this PR merged now and worry about more cleverness in a separate issue. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the valuable feedback!
@emilevauge PTAL. :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zweizeichen
LGTM :)
* Added warning if network could not be found * Removed regex import from master * Corrected wrong function call
* Added warning if network could not be found * Removed regex import from master * Corrected wrong function call
* Added warning if network could not be found * Removed regex import from master * Corrected wrong function call
* Added warning if network could not be found * Removed regex import from master * Corrected wrong function call
* Added warning if network could not be found * Removed regex import from master * Corrected wrong function call
Closes #1308 - avoids rebase entanglements and general time-travel-related corruption :)