mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-05 21:21:42 +00:00
Remove PortSpecs from Config
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
+1
-10
@@ -453,19 +453,11 @@ func expose(b *Builder, args []string, attributes map[string]bool, original stri
|
||||
b.Config.ExposedPorts = make(nat.PortSet)
|
||||
}
|
||||
|
||||
ports, bindingMap, err := nat.ParsePortSpecs(append(portsTab, b.Config.PortSpecs...))
|
||||
ports, _, err := nat.ParsePortSpecs(portsTab)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, bindings := range bindingMap {
|
||||
if bindings[0].HostIp != "" || bindings[0].HostPort != "" {
|
||||
fmt.Fprintf(b.ErrStream, " ---> Using Dockerfile's EXPOSE instruction"+
|
||||
" to map host ports to container ports (ip:hostPort:containerPort) is deprecated.\n"+
|
||||
" Please use -p to publish the ports.\n")
|
||||
}
|
||||
}
|
||||
|
||||
// instead of using ports directly, we build a list of ports and sort it so
|
||||
// the order is consistent. This prevents cache burst where map ordering
|
||||
// changes between builds
|
||||
@@ -479,7 +471,6 @@ func expose(b *Builder, args []string, attributes map[string]bool, original stri
|
||||
i++
|
||||
}
|
||||
sort.Strings(portList)
|
||||
b.Config.PortSpecs = nil
|
||||
return b.commit("", b.Config.Cmd, fmt.Sprintf("EXPOSE %s", strings.Join(portList, " ")))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user