-
Notifications
You must be signed in to change notification settings - Fork 2k
Add .IPAddresses as formatting option on docker ps #2733
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
base: master
Are you sure you want to change the base?
Conversation
Had this branch on my computer; not sure if we should merge (see discussion on moby/moby#8786), but thought to at least push it to github 😂 |
d5ebad2
to
72a56bd
Compare
This allows showing the IP address for each network that the container is attached to, for example: docker network create foo docker run -d --name foo nginx:alpine docker network connect foo foo container container ls --format 'table {{.ID}}\\t{{join .IPAddresses ", "}}' CONTAINER ID IP ADDRESSES 17e7d1910fc0 bridge:172.17.0.2, foo:172.19.0.2 container container ls --format='{{json .IPAddresses}}' | jq . [ "bridge:172.17.0.2", "foo:172.19.0.2" ] Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
72a56bd
to
d24907b
Compare
Are there any blockers (unrelated to Moby) to get this PR merged into Docker CLI? I think this would make the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I don't understand the need for ps
command uses an intermediate ContainerContext
type and not just expose the plain types.Container
returned by the API for formatting
I want to have another look at this (also taking into account IPv6 addresses); slightly wondering if the
I think this was done to decorate the struct with formatting functions (such as this one); the formatting is meant for "printing on the CLI", and is kinda separate from both "client" and "api", so may not be very suitable for inclusion in the upstream moby repository (as part of the types) |
right, I've been confused by the naming used on |
fixes moby/moby#8786
This allows showing the IP address for each network that the container is attached to,
for example:
- Description for the changelog