Docker run allocate same host port for different container ports
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
Docker run allocate same host port for different container ip & ports.
Both 0.0.0.0: 3000 and 127.0.0.1: 9229 are mapping to 32768.
stephaniesmbp2:nodetest123 stephanie$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b92db8fcf4f5 nodetest-image "docker-entrypoint.s…" 7 seconds ago Up 6 seconds 0.0.0.0:32768->3000/tcp, 127.0.0.1:32768->9229/tcp nodetest-image
Steps to reproduce the issue:
- stop all containers and images, prune the docker system. and restart docker
- run
docker build -t nodetest-image .to create a image - run
docker run --name nodetest-image -p 127.0.0.1::9229 -P -dt nodetest-imageto start the container
Describe the results you received:
docker assign same host port for different container ip&ports in the same docker run command
Describe the results you expected:
the two host ports should be different.
Additional information you deem important (e.g. issue happens only occasionally):
Full log:
dockerPortAllocate.docx
Output of docker version:
Version: 19.03.4
API version: 1.40
Go version: go1.12.10
Git commit: 9013bf5
Built: Thu Oct 17 23:44:48 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.4
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: 9013bf5
Built: Thu Oct 17 23:50:38 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
Output of docker info:
Client:
Debug Mode: false
Server:
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 124
Server Version: 19.03.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.184-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 8.021GiB
Name: docker-desktop
ID: POHW:V7CU:LJ37:MPFM:BU2C:JYU7:JXZH:WK4H:EQL6:6QPU:KIDF:BMGB
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
mycluster.icp:8500
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Additional environment details (AWS, VirtualBox, physical, etc.):
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 behavior with the reported docker run command and inspect the resulting docker ps port mappings. Determine why the two published ports receive the same host port; done means the two container ports are assigned distinct host ports while preserving their requested addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100