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
[carry 22894] Adding network filter to docker ps command #23300
[carry 22894] Adding network filter to docker ps command #23300
Conversation
bab7713
to
3dd6ebd
Compare
ping @vdemeester @cpuguy83; moved this back to code-review because of the latest changes |
Hm, guess Windows doesn't have "bridge" network, so I should make that dependent on platform
|
Yeah, windows has a "nat" network. |
I'll just create a custom network, then I don't have to make platform-specific changes |
3dd6ebd
to
0e6da8d
Compare
Well, I'll be. Doesn't windows support dashes in network names?
@msabansal is that a known issue? let me rename that network for now |
0e6da8d
to
7b2dfa6
Compare
Opened an issue for the Windows issue; #23314 |
@@ -804,3 +804,60 @@ func (s *DockerSuite) TestPsFormatSize(c *check.C) { | |||
lines = strings.Split(out, "\n") | |||
c.Assert(lines[8], checker.HasPrefix, "size:", check.Commentf("Size should be appended on a newline")) | |||
} | |||
|
|||
func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) { | |||
// create a network, and some containers |
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.
Let's add a TODO
and a requires DaemonIsLinux
on that then 👼
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.
Or make it conditional, and filter on "nat" for windows. Didn't come round to do this yet, will try to do so later today
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
7b2dfa6
to
e675f3f
Compare
This adds support for filtering by network ID, to be consistent with other filter options. Note that only *full* matches are returned; this is consistent with other filters (e.g. volume), that also return full matches only. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
e675f3f
to
7c46ba0
Compare
@vdemeester disabled the test for now on Windows, and added a TODO |
LGTM 🐮 |
LGTM |
And win2lin finished but didn't notify. Merging. |
Actually, let me set it to docs-review :) |
docs LGTM 🐮 |
author LGTM |
closes #22894
- What I did
Carry of #22894, rebased, and adding filter by network id.
- How to verify it
Output should show only the container with name "onbridgenetwork"
Output should show both the containers "onbrigenetwork" and "onnonenetwork"
$ docker network inspect --format "{{.ID}}" net1 8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5 $ docker ps --filter network=8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
Output should only show the
onbridgenetwork
container- Description for the changelog
Add support for
docker ps --filter network=<network-id | network-name>
to filter containers by the network(s) they're connected to.