Browse code

Refactor internal port mappings

Michael Crosby authored on 2013/09/05 07:32:29
Showing 1 changed files
... ...
@@ -250,17 +250,6 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
250 250
 		return nil, nil, cmd, err
251 251
 	}
252 252
 
253
-	// Merge in exposed ports to the map of published ports
254
-	for _, e := range flExpose {
255
-		if strings.Contains(e, ":") {
256
-			return nil, nil, cmd, fmt.Errorf("Invalid port format for -expose: %s", e)
257
-		}
258
-		p := NewPort(splitProtoPort(e))
259
-		if _, exists := ports[p]; !exists {
260
-			ports[p] = struct{}{}
261
-		}
262
-	}
263
-
264 253
 	config := &Config{
265 254
 		Hostname:        *flHostname,
266 255
 		Domainname:      domainname,
... ...
@@ -328,6 +317,7 @@ func (settings *NetworkSettings) PortMappingAPI() []APIPort {
328 328
 			continue
329 329
 		}
330 330
 		for _, binding := range bindings {
331
+			p, _ := parsePort(port.Port())
331 332
 			h, _ := parsePort(binding.HostPort)
332 333
 			mapping = append(mapping, APIPort{
333 334
 				PrivatePort: int64(p),