Docker cli does not support defining port ranges in long form.
Open
Nobody has claimed this yet.
area/networking
area/stack
area/swarm
exp/intermediate
kind/enhancement
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
docker cli does not support a method to publish a range of ports using the long form syntax.
Steps to reproduce the issue:
- When Deploying a container:
docker run -p mode=host,target=9900-9999,published=9900-9999,protocol=tcp -d hello-world - When Deploying a service:
See related issue: https://github.com/moby/moby/issues/32551 - When Deploying a container using docker-compose:
See related issue: https://github.com/docker/compose/issues/5613
Describe the results you received:
PS D:\issue> docker run -p mode=host,target=9900-9999,published=9900-9999,protocol=tcp -d hello-world
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Invalid containerPort: mode=host,target=9900-9999,published=9900-9999,protocol=tcp.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
Describe the results you expected:
PS D:\issue> docker run -p mode=host,target=9900-9999,published=9900-9999,protocol=tcp -d hello-world
<ContainerId>
Impacts:
- Customers with needs to define a large range of port bindings must declare each port individually if they need to use the long form syntax. This is burdensome and I would prefer to see parity between the long and short form syntax.
Output of docker version:
PS D:\issue> docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.24)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:15:52 2017
OS/Arch: windows/amd64
Experimental: true
Output of docker info:
D:\issue> docker info
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 148
Server Version: 17.12.0-ce
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd gelf json-file logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 15063 (15063.0.amd64fre.rs2_release.170317-1834)
Operating System: Windows 10 Pro
OSType: windows
Architecture: x86_64
CPUs: 24
Total Memory: 31.95GiB
Name: PMMP7-562
ID: 3NOE:IXLT:UD6I:BJXF:U3IE:UJIX:YUAO:HJZH:TLI2:ABHW:VB4K:BKB4
Docker Root Dir: D:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 25
System Time: 2018-01-26T12:02:47.4595705-06:00
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Related Issues:
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 docker run -p long-form command shown in the issue and trace how its port specification is parsed. Review the related Moby, Compose, and Docker CLI issues, then verify that long-form syntax accepts port ranges and matches the expected container behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100