Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Implement printing published ports - #98

Merged
rumpl merged 3 commits into
masterfrom
feat-port-print
May 18, 2020
Merged

Implement printing published ports#98
rumpl merged 3 commits into
masterfrom
feat-port-print

Conversation

@rumpl

@rumplrumpl commented May 15, 2020

Copy link
Copy Markdown
Contributor
❯ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9126fca893ca nginx "nginx -g 'daemon of…" 23 seconds ago Up Less than a second 0.0.0.0:80->80/tcp, 0.0.0.0:8000-9000->8000-9000/tcp hopeful_banzai
❯ ./bin/docker --context moby ps
CONTAINER ID IMAGE COMMAND STATUS PORTS
9126fca893ca nginx nginx -g 'daemon off;' Up Less than a second 0.0.0.0:80->80/tcp, 0.0.0.0:8000-9000->8000-9000/tcp

Comment threadazure/convert/ports.go Outdated
@rumplrumpl mentioned this pull request May 18, 2020

@chris-cronechris-crone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment threadMakefile Outdated
Comment threadcli/cmd/ps.go Outdated
}

// PortsString returns a human readable published ports
func PortsString(ports []containers.Port) string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case it's useful, I implemented some presentation logic for ports in the CLI a while back (see docker/cli#581)

I also recently discovered that there's a weird discrepancy between services and containers when publishing port-ranges (still to investigate further);

For a service (docker service create);

-p 8080-8090:80 means: map container port 80 to ports 8080 - 8090 on the host

For a container;

-p 8080-8090:80 means: map container port 80 to the first available port within 8080 - 8090

I never realised this discrepancy was there tbh (as mentioned; need to investigate further if this was on purpose or an oversight)

Comment threadcli/cmd/ps.go
Comment threadazure/convert/ports.go
Comment threadcli/formatter/container.go Outdated

@silvin-lubeckisilvin-lubecki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rumpl
rumpl merged commit 0c6b6be into masterMay 18, 2020
@rumpl
rumpl deleted the feat-port-print branch May 18, 2020 11:48
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@rumpl@gtardif@thaJeztah@chris-crone@silvin-lubecki