[Carry 17059] allow filtering containers by any status#17908
Conversation
There was a problem hiding this comment.
if you use --no-trunc you don't need truncate with [:12] and it's more robust
|
apart from small nit, lgtm |
|
@calavera I wonder about the test. It already works with the current master (even 1.8.3) : λ docker run -itd busybox
0471b3abc8ad5f2edfd22ad62c1bb2515154e6f5230260ac1e477bc751f52672
λ docker pause 0471b3abc8ad5f2edfd22ad62c1bb2515154e6f5230260ac1e477bc751f52672
0471b3abc8ad5f2edfd22ad62c1bb2515154e6f5230260ac1e477bc751f52672
λ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0471b3abc8ad busybox "sh" 9 seconds ago Up 8 seconds (Paused) happy_turing
a1b1c4074925 vdemeester/spotify "spotify -stylesheet=" 34 hours ago Exited (0) 26 hours ago spotify
λ docker ps -q --filter=status=paused
0471b3abc8adWith current master : root@2c36df197cb6:/go/src/github.com/docker/docker# docker create busybox
4fb77da66bd15b1caffb48d83e717a433379230d46ea9243aa66f43b2a469b60
root@2c36df197cb6:/go/src/github.com/docker/docker# docker run -itd busybox
477c598e860b0b23dc82e52a92ba4a34748c15fee993123eb9e2e357de7e0b51
root@2c36df197cb6:/go/src/github.com/docker/docker# docker ps --filter=status=paused
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
477c598e860b busybox "sh" 4 minutes ago Up 4 minutes (Paused) elated_ptolemy
root@2c36df197cb6:/go/src/github.com/docker/docker# docker ps --filter=status=created
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4fb77da66bd1 busybox "sh" 8 minutes ago Created cranky_bose |
|
@calavera what can you say about tests? :) |
|
It looks like "paused" is considered a "running" status. So the only state that won't be listed without this patch is "dead". It's pretty hard to get a container in that state in the tests. I could create a json configuration with that state on disk and see what happens, but it don't look very nice. |
|
@calavera need rebase. |
Signed-off-by: Kamil Domański <kamil@domanski.co> (cherry picked from commit 9ada6a0)
ca74f07 to
0fa7ff0
Compare
|
rebased |
Signed-off-by: David Calavera <david.calavera@gmail.com>
0fa7ff0 to
2a07b19
Compare
|
LGTM |
[Carry 17059] allow filtering containers by any status
|
Hi, how can I test |
|
status "dead" is an exceptional case, so hard to test |
|
hi @thaJeztah ,thank you for the quick reply. maybe it is also hard to explain it, but just out of curiosity, in which stuation can one container be in a dead state? |
|
Usually that is because (for example) a container was attempted to be removed, but something failed during that process; basically the container is then defunct, and will be removed/cleaned up on daemon restart. |
|
thanks @thaJeztah |
Carry #17059.
I added a test to make sure this feature works as expected.
/cc @jfrazelle because she left a comment in that test that I don't think applies anymore.