-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose ps should show port ranges as docker ps does #6910
Comments
Fixes docker#6910 Signed-off-by: Wagubi Brian <wagubib@gmail.com>
Fixes docker#6910 Signed-off-by: Wagubi Brian <wagubib@gmail.com>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
Need to check how the docker/cli detect port range to display things this way and adopt the same approach (or even better: reuse code) internaly tracked as https://docker.atlassian.net/browse/IL-595 |
For I recall I also did docker/cli#581 for |
Seems we will need a 3rd copy/paste as Compose API doesn't rely on moby's |
Ran a quick test trying to understand how port range are managed and detected by the Docker CLI, and... $ docker run -p 8080-8090:80-90 -d nginx
d196e54b746554067c611e46ab99bf6ea0cd4e998f4f3e9560501d27e0c350f7
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d196e54b7465 nginx "/docker-entrypoint.…" 8 seconds ago Up 7 seconds 0.0.0.0:8080->80/tcp, :::8080->80/tcp, 0.0.0.0:8081->81/tcp, :::8081->81/tcp, 0.0.0.0:8082->82/tcp, :::8082->82/tcp, 0.0.0.0:8083->83/tcp, :::8083->83/tcp, 0.0.0.0:8084->84/tcp, :::8084->84/tcp, 0.0.0.0:8085->85/tcp, :::8085->85/tcp, 0.0.0.0:8086->86/tcp, :::8086->86/tcp, 0.0.0.0:8087->87/tcp, :::8087->87/tcp, 0.0.0.0:8088->88/tcp, :::8088->88/tcp, 0.0.0.0:8089->89/tcp, :::8089->89/tcp, 0.0.0.0:8090->90/tcp, :::8090->90/tcp goofy_bhaskara```
Did I missed something @thaJeztah ? |
Hmm... yes, I see the same; looks like it's broken if both sides are not using the same port range. If host and container range are the same, it groups correctly: docker run -d -p 80-90:80-90 --name foobar nginx:alpine
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34fdb2a76d0a nginx:alpine "/docker-entrypoint.…" 4 seconds ago Up 2 seconds 0.0.0.0:80-90->80-90/tcp, :::80-90->80-90/tcp foobar
docker rm -fv foobar
docker run -d \
-p 60-61:60-61 \
-p 62:61 \
-p 80:80 \
-p 81:80 \
-p 90-95:90-95 \
-p 90-92:90-92/udp \
-p 93-96:93-96/udp \
--name foobar \
nginx:alpine
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae58d6f2cea7 nginx:alpine "/docker-entrypoint.…" 5 seconds ago Up 4 seconds 0.0.0.0:60-61->60-61/tcp, :::60-61->60-61/tcp, 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:90-95->90-95/tcp, :::90-95->90-95/tcp, 0.0.0.0:90-96->90-96/udp, :::90-96->90-96/udp, 0.0.0.0:62->61/tcp, :::62->61/tcp, 0.0.0.0:81->80/tcp, :::81->80/tcp foobar
docker rm -fv foobar But if they're different, it breaks: docker run -d -p 8080-8090:80-90 --name foobar nginx:alpine
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
758a5fd0f373 nginx:alpine "/docker-entrypoint.…" 4 seconds ago Up 2 seconds 0.0.0.0:8080->80/tcp, :::8080->80/tcp, 0.0.0.0:8081->81/tcp, :::8081->81/tcp, 0.0.0.0:8082->82/tcp, :::8082->82/tcp, 0.0.0.0:8083->83/tcp, :::8083->83/tcp, 0.0.0.0:8084->84/tcp, :::8084->84/tcp, 0.0.0.0:8085->85/tcp, :::8085->85/tcp, 0.0.0.0:8086->86/tcp, :::8086->86/tcp, 0.0.0.0:8087->87/tcp, :::8087->87/tcp, 0.0.0.0:8088->88/tcp, :::8088->88/tcp, 0.0.0.0:8089->89/tcp, :::8089->89/tcp, 0.0.0.0:8090->90/tcp, :::8090->90/tcp foobar
docker rm -fv foobar |
Looks like the implementation I did for services (in docker/cli#581) does seem to work, but admitted, swarm services don't allow binding to a specific IP-address, so that would need to be taken into account for docker service create -p 80-90:80-90 --name foobar nginx:alpine
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
f9wt4oyuk6ts foobar replicated 1/1 nginx:alpine *:80-90->80-90/tcp
docker service rm foobar
docker service create \
-p 60-61:60-61 \
-p 62:61 \
-p 80:80 \
-p 81:80 \
-p 90-95:90-95 \
-p 90-92:90-92/udp \
-p 93-96:93-96/udp \
--name foobar \
nginx:alpine
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
07m2ez999t8a foobar replicated 1/1 nginx:alpine *:60-61->60-61/tcp, *:62->61/tcp, *:80-81->80/tcp, *:90-95->90-95/tcp, *:90-96->90-96/udp
docker service rm foobar
docker service create -p 8080-8090:80-90 --name foobar nginx:alpine
ID NAME MODE REPLICAS IMAGE PORTS
cj3cp93xftu7 foobar replicated 1/1 nginx:alpine *:8080-8090->80-90/tcp
docker service rm foobar |
docker ps
gives a sensible output for ranges1-5431/tcp, 5433-30000/tcp, 0.0.0.0:5432->5432/tcp
but frustratinglydocker-compose ps
gives1/tcp, 10/tcp, 100/tcp, 1000/tcp, 10000/tcp, 10001/tcp, 10002/tcp, 10003/tcp, 10004/tcp, 10005/tcp, 10006/tcp, 10007/tcp
.While large ranges like this are a bit nuts and that can be debated somewhere else, it would be helpful for docker-compose to match docker in the output format for
ps
in this case.The text was updated successfully, but these errors were encountered: