Warn when using host-ip for published ports#1017
Conversation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
|
I was working on this a while back, and recalled I had this branch; should check if the validation/warning is printed in the right part of the code 😅 (may need a unit test as well), but thought; let me push this |
|
|
||
| for _, binding := range portBindings[port] { | ||
| if binding.HostIP != "" && binding.HostIP != "0.0.0.0" { | ||
| logrus.Warnf("ignoring IP-address (%s:%s:%s) service will listen on '0.0.0.0'", binding.HostIP, binding.HostPort, port) |
There was a problem hiding this comment.
Should this be logrus? I think usually we just print directly to stderr? But also it's weird to write to stdio in this package.
There was a problem hiding this comment.
I think I used it based on other examples I found in the code-base (e.g.
cli/cli/compose/loader/loader.go
Line 475 in cea4d37
|
Is a warning enough? e.g. “Warning: your data has just been exposed” secure by default, says that it should be an error (no deploy). |
|
For backwards compatibility, I think it needs to just be a warning. |
|
Having a warning is an improvement. Is any one looking at adding support for specifying addresses? |
Swarm Mode services don't support binding to a specific IP-address. Print a warning that the IP-address will be ignored if one is specified.
relates to #1016
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)