diff --git a/pkg/commands/expose.go b/pkg/commands/expose.go index 2c6e1a9f1..c2a75f9ea 100644 --- a/pkg/commands/expose.go +++ b/pkg/commands/expose.go @@ -11,7 +11,7 @@ type ExposeCommand struct { } func (r *ExposeCommand) ExecuteCommand(config *manifest.Schema2Config) error { - return updateExposedPorts(r.Ports, config) + return updateExposedPorts(r.cmd.Ports, config) } func updateExposedPorts(ports []string, config *manifest.Schema2Config) error { @@ -24,7 +24,8 @@ func updateExposedPorts(ports []string, config *manifest.Schema2Config) error { if !strings.Contains(p, "/") { p = p + "/tcp" } - existingPorts[p] = {} + var x struct{} + existingPorts[manifest.Schema2Port(p)] = x } config.ExposedPorts = existingPorts return nil @@ -36,5 +37,5 @@ func (r *ExposeCommand) FilesToSnapshot() []string { func (r *ExposeCommand) CreatedBy() string { s := []string{"/bin/sh", "-c"} - return strings.Join(append(s, r.Ports...), " ") + return strings.Join(append(s, r.cmd.Ports...), " ") } diff --git a/pkg/commands/expose_test.go b/pkg/commands/expose_test.go index 37f84094b..b06b6766e 100644 --- a/pkg/commands/expose_test.go +++ b/pkg/commands/expose_test.go @@ -17,12 +17,14 @@ func TestUpdateExposedPorts(t *testing.T) { "8080", "8081/tcp", "8082", + "8083/udp", } expectedPorts := manifest.Schema2PortSet{ "8080/tcp": {}, "8081/tcp": {}, "8082/tcp": {}, + "8083/udp": {}, } updateExposedPorts(ports, cfg)