Skip to content

[1.12.2] Service create with two ports published fails #27469

@thaJeztah

Description

@thaJeztah

When creating a service that publishes two ports, but doesn't specify the host-port, service create fails;

$ docker service create --publish 80 --publish 443 --name web nginx:alpine
Error response from daemon: rpc error: code = 3 desc = EndpointSpec: duplicate published ports provided

Note that this works;

docker service create --publish 80:80 --publish 443:443 --name web nginx:alpine

And so does;

docker service create --publish 80 --name web nginx:alpine

or

docker service create --publish 80 --name web nginx:alpine

or

docker service create --publish 80:80 --publish 443 --name web nginx:alpine

Based on the above (especially the last one), it looks like published multiple ports tries to assign the same "random" port multiple times.

Tested on;

Client:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 05:27:08 2016
 OS/Arch:      darwin/amd64
 Experimental: true

Server:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 05:27:08 2016
 OS/Arch:      linux/amd64
 Experimental: true

and on Linux (to exclude it being a Docker for Mac issue)

Client:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 17:39:06 2016
 OS/Arch:      linux/amd64
 Experimental: true

Server:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 17:39:06 2016
 OS/Arch:      linux/amd64
 Experimental: true

This looks to be a regression in 1.12.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/swarmkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.priority/P1Important: P1 issues are a top priority and a must-have for the next release.version/1.12

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions