Skip to content

"docker ps" doesn't include non-running containers with --before filter #17716

@wenchma

Description

@wenchma

Description of problem:

ubuntu@docker:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                    PORTS               NAMES
a3396c149690        busybox             "sh"                24 hours ago        Up 9 seconds                                  container3
e86c22769399        busybox             "sh"                24 hours ago        Exited (0) 23 hours ago                       container2
0e338f61bf62        busybox             "sh"                24 hours ago        Up 14 seconds                                 container1
ubuntu@docker:~$ docker ps --before=container3
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
0e338f61bf62        busybox             "sh"                24 hours ago        Up 27 seconds                           container1
ubuntu@docker:~$ docker ps --since=container1
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                    PORTS               NAMES
a3396c149690        busybox             "sh"                24 hours ago        Up 31 seconds                                 container3
e86c22769399        busybox             "sh"                24 hours ago        Exited (0) 23 hours ago                       container2

I think the before filter should include the non-running containers like since filter, also like the man doc (https://github.com/docker/docker/blob/master/man/docker-ps.1.md#options) says.

docker version

Client:
 Version:      1.9.0-rc5
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   9318004
 Built:        Tue Nov  3 05:59:27 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.0-rc5
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   9318004
 Built:        Tue Nov  3 05:59:27 UTC 2015
 OS/Arch:      linux/amd64

docker info 👍

Client:
 Version:      1.9.0-rc5
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   9318004
 Built:        Tue Nov  3 05:59:27 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.0-rc5
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   9318004
 Built:        Tue Nov  3 05:59:27 UTC 2015
 OS/Arch:      linux/amd64
ubuntu@docker:~$ docker info
Containers: 3
Images: 2
Server Version: 1.9.0-rc5
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 8
 Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-43-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 4
Total Memory: 15.67 GiB
Name: docker
ID: UT5D:M5ZY:IEXQ:6LCU:YX6J:ZMWM:BLNJ:MTXH:PRHO:ETVF:3FHH:6LC4
WARNING:

uname -a 👍

Linux docker 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.):OpenStack Cloud instance

Actual Results: before filter doesn't include the non-running containers

Expected Results: before filter includes the non-running containers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions