diff --git a/azure/backend.go b/azure/backend.go index c7a8beae4..174d97123 100644 --- a/azure/backend.go +++ b/azure/backend.go @@ -94,10 +94,18 @@ func (cs *containerService) List(ctx context.Context) ([]containers.Container, e func (cs *containerService) Run(ctx context.Context, r containers.ContainerConfig) error { var project compose.Project project.Name = r.ID + var ports []types.ServicePortConfig + for _, p := range r.Ports { + ports = append(ports, types.ServicePortConfig{ + Target: p.Destination, + Published: p.Source, + }) + } project.Services = []types.ServiceConfig{ { Name: r.ID, Image: r.Image, + Ports: ports, }, } diff --git a/cli/cmd/run_opts.go b/cli/cmd/run_opts.go index 4e00c5eb2..ee536ef36 100644 --- a/cli/cmd/run_opts.go +++ b/cli/cmd/run_opts.go @@ -1,6 +1,7 @@ package cmd import ( + "strconv" "strings" "github.com/docker/api/containers" @@ -16,9 +17,18 @@ func toPorts(ports []string) ([]containers.Port, error) { for _, port := range ports { parts := strings.Split(port, ":") + source, err := strconv.ParseUint(parts[0], 10, 32) + if err != nil { + return nil, err + } + destination, err := strconv.ParseUint(parts[1], 10, 32) + if err != nil { + return nil, err + } + result = append(result, containers.Port{ - Source: parts[0], - Destination: parts[1], + Source: uint32(source), + Destination: uint32(destination), }) } return result, nil diff --git a/containers/api.go b/containers/api.go index dc3f7c273..c68316d85 100644 --- a/containers/api.go +++ b/containers/api.go @@ -18,8 +18,8 @@ type Container struct { } type Port struct { - Source string - Destination string + Source uint32 + Destination uint32 } type ContainerConfig struct {