From 363335ec9b325ba28e6304fa48c17ab78e4c2a81 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 12 Dec 2017 16:45:19 -0800 Subject: [PATCH] Warn when using host-ip for published ports Signed-off-by: Sebastiaan van Stijn --- opts/port.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opts/port.go b/opts/port.go index 5a5a18738f..201aefafc8 100644 --- a/opts/port.go +++ b/opts/port.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/go-connections/nat" + "github.com/sirupsen/logrus" ) const ( @@ -147,6 +148,9 @@ func ConvertPortToPortConfig( ports := []swarm.PortConfig{} 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) + } hostPort, err := strconv.ParseUint(binding.HostPort, 10, 16) if err != nil && binding.HostPort != "" { return nil, fmt.Errorf("invalid hostport binding (%s) for port (%s)", binding.HostPort, port.Port())