Skip to content
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

Expecting a better way to show a bunch of ports in "docker ps" #1499

Open
Eroyi opened this issue Nov 6, 2018 · 3 comments
Open

Expecting a better way to show a bunch of ports in "docker ps" #1499

Eroyi opened this issue Nov 6, 2018 · 3 comments

Comments

@Eroyi
Copy link

Eroyi commented Nov 6, 2018

For the guy who run node on docker, or even an OS, there are always a bunch of ports need to be set.
But showing these ports in this way, showing in one line? It's quite difficult to read actually.
Example
dport

I know there's a way to create consecutive ranges of ports with command like "-p 8080-8090:80-90", but sometimes "which port" is not what I can dicide.
So if there's a way can printing ports in one column, rather than one line, it will be very nice.
Expect (similar)
dport2

@jewertow
Copy link

jewertow commented Nov 8, 2018

I would be very happy if I could take care of it, but I need information from the maintainer, if I can add some switch for docker ps that would format the list of ports. Otherwise please give me some hints how to fix it.

@thaJeztah
Copy link
Member

Breaking over multiple lines will probably break a lot of users that use the docker ps output for automation. We can improve the output for consecutive ranges as a start though (as was done for services, in #581)

@thaJeztah
Copy link
Member

thaJeztah commented Nov 8, 2018

I did have a look at the "json" representation for this output, but unfortunately in the JSON representation, it's a string as well (not an array/list of ports);

docker ps --format '{{json .}}'
{
  "Command": "\"nginx -g 'daemon of…\"",
  "CreatedAt": "2018-11-08 17:48:18 +0000 UTC",
  "ID": "1252b4457cfe",
  "Image": "nginx:alpine",
  "Labels": "maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>",
  "LocalVolumes": "0",
  "Mounts": "",
  "Names": "loving_dubinsky",
  "Networks": "bridge",
  "Ports": "0.0.0.0:8080->80/tcp, 0.0.0.0:8081->81/tcp, 0.0.0.0:8082->82/tcp, 0.0.0.0:8083->83/tcp, 0.0.0.0:8084->84/tcp, 0.0.0.0:8085->85/tcp, 0.0.0.0:8086->86/tcp, 0.0.0.0:8087->87/tcp, 0.0.0.0:8088->88/tcp, 0.0.0.0:8089->89/tcp, 0.0.0.0:8090->90/tcp",
  "RunningFor": "36 seconds ago",
  "Size": "0B",
  "Status": "Up 35 seconds"
}

Perhaps some utility --format function to split/format those ranges could work, but I'd have to give that some thinking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants