mirror of https://github.com/docker/docs.git
Merge pull request #1181 from dotcloud/export_portmapping
Export PortMapping in container.go
This commit is contained in:
commit
8e49cb453f
10
container.go
10
container.go
|
@ -202,14 +202,14 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
|
||||||
return config, hostConfig, cmd, nil
|
return config, hostConfig, cmd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type portMapping map[string]string
|
type PortMapping map[string]string
|
||||||
|
|
||||||
type NetworkSettings struct {
|
type NetworkSettings struct {
|
||||||
IPAddress string
|
IPAddress string
|
||||||
IPPrefixLen int
|
IPPrefixLen int
|
||||||
Gateway string
|
Gateway string
|
||||||
Bridge string
|
Bridge string
|
||||||
PortMapping map[string]portMapping
|
PortMapping map[string]PortMapping
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns a human-readable description of the port mapping defined in the settings
|
// String returns a human-readable description of the port mapping defined in the settings
|
||||||
|
@ -693,9 +693,9 @@ func (container *Container) allocateNetwork() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
container.NetworkSettings.PortMapping = make(map[string]portMapping)
|
container.NetworkSettings.PortMapping = make(map[string]PortMapping)
|
||||||
container.NetworkSettings.PortMapping["Tcp"] = make(portMapping)
|
container.NetworkSettings.PortMapping["Tcp"] = make(PortMapping)
|
||||||
container.NetworkSettings.PortMapping["Udp"] = make(portMapping)
|
container.NetworkSettings.PortMapping["Udp"] = make(PortMapping)
|
||||||
for _, spec := range container.Config.PortSpecs {
|
for _, spec := range container.Config.PortSpecs {
|
||||||
nat, err := iface.AllocatePort(spec)
|
nat, err := iface.AllocatePort(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue