docker ps -l doesn't list the existing container
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
I have removed a lot of stopped container, except one. Then I was trying to list the only existing (stopped) container with docker ps -l or docker ps -n1 but it yields nothing.
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -n1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
On the contrary docker ps -a does lists the container:
$ docker ps -qa
8f0b52e5b059
Strangely if I increase the argument for -n/--last the container is listed:
$ docker ps -qn 1
$ docker ps -qn 2
$ docker ps -qn 10
$ docker ps -qn 11
$ docker ps -qn 12
$ docker ps -qn 13
8f0b52e5b059
Steps to reproduce the issue:
Describe the results you received:
> docker ps -ql
# nothing
Describe the results you expected:
> docker ps -ql
8f0b52e5b059
Output of docker version:
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:21:11 2020
OS/Arch: darwin/amd64
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:29:16 2020
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Output of docker info:
Client:
Debug Mode: false
Plugins:
app: Docker Application (Docker Inc., v0.8.0)
buildx: Build with BuildKit (Docker Inc., v0.3.0-5-g5b97415-tp-docker)
clip: Docker Client Plugins Manager (Łukasz Lach, v19.06.0)
dive: Explore contents of the image layers (Łukasz Lach, v19.06.0)
microscan: Scan the security of an image with Aqua Microscanner (Łukasz Lach, v19.06.0)
runlike: Get the command line necessary to run a copy of any container (Łukasz Lach, v19.06.0)
wasm: Run wasm containers (Docker Inc.)
mutagen: Synchronize files with Docker Desktop (Docker Inc., testing)
Server:
Containers: 13
Running: 11
Paused: 0
Stopped: 2
Images: 11
Server Version: 19.03.8
Storage Driver: overlay2
Backing Filesystem: <unknown>
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.76-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.947GiB
Name: docker-desktop
ID: QNMK:EWUP:NUXS:ICP5:CKGQ:AVYG:AEDB:XLSX:LK3Y:G3C7:GNBV:5GUO
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 102
Goroutines: 96
System Time: 2020-04-16T08:26:08.3063448Z
EventsListeners: 3
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
docker.for.mac.localhost:5000
localhost:5000
registry.ing.k8z.eu
registry.k8z.eu
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Additional environment details (AWS, VirtualBox, physical, etc.):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Docker CLI implementation for docker ps and its -l/--latest and -n/--last options. Reproduce the behavior using the provided stopped-container commands and compare it with docker ps -a; done means the latest or requested number of containers includes the existing stopped container consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100