diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 19a2d158cc..0615e1b556 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -686,6 +686,7 @@ func parseNetworkOpts(copts *containerOptions) (map[string]*networktypes.Endpoin ) for i, n := range copts.netMode.Value() { + n := n if container.NetworkMode(n.Target).IsUserDefined() { hasUserDefined = true } else { diff --git a/cli/command/service/update.go b/cli/command/service/update.go index c95dcf50d3..6578047cbe 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -1004,6 +1004,7 @@ func updatePorts(flags *pflag.FlagSet, portConfig *[]swarm.PortConfig) error { // Build the current list of portConfig for _, entry := range *portConfig { + entry := entry if _, ok := portSet[portConfigToString(&entry)]; !ok { portSet[portConfigToString(&entry)] = entry } @@ -1031,6 +1032,7 @@ portLoop: ports := flags.Lookup(flagPublishAdd).Value.(*opts.PortOpt).Value() for _, port := range ports { + port := port if _, ok := portSet[portConfigToString(&port)]; ok { continue }