Stack deploy fails if "target" or "published" port is a string
Open
Nobody has claimed this yet.
area/networking
area/stack
area/swarm
kind/bug
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
As reported by @ushuz https://github.com/docker/cli/issues/229#issuecomment-381066533
version: '3.4'
services:
web:
image: nginx:alpine
ports:
- published: '8080'
target: 80
Deploying the above produces:
$ docker stack deploy -c docker-compose.yml hello
services.web.ports.0.published must be a integer
The same issue is present for target:
version: '3.4'
services:
web:
image: nginx:alpine
ports:
- published: 8080
target: '80'
$ docker stack deploy -c docker-compose.yml hello
services.web.ports.0.target must be a integer
Changing both to an integer makes this work:
version: '3.4'
services:
web:
image: nginx:alpine
ports:
- published: 8080
target: 80
$ docker stack deploy -c docker-compose.yml hello
Creating network hello_default
Creating service hello_web
Reproduced on:
Client:
Version: 18.05.0-ce
API version: 1.37
Go version: go1.9.5
Git commit: f150324
Built: Wed May 9 22:12:05 2018
OS/Arch: darwin/amd64
Experimental: true
Orchestrator: swarm
Server:
Engine:
Version: 18.05.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: f150324
Built: Wed May 9 22:20:16 2018
OS/Arch: linux/amd64
Experimental: true
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the quoted published and target port cases with the docker stack deploy command and trace the stack deploy port validation path. Done means both quoted numeric values are accepted like integer values, while invalid port values still fail; add or update coverage where the existing validation tests are located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100