-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Description
The docker engine doesn't correctly count the number of image's container
Steps to reproduce the issue:
- Run a container
sudo docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres - Show that the container is running
sudo docker ps
3.Query the deamon about the images :sudo curl --unix-socket /var/run/docker.sock http://localhost/v1.41/images/json
Describe the results you received:
[{"Containers":-1, "Created":1641260421, "Id":"sha256:d554ff53ff5c2b0113c8e060a4a9874d5e69186d66a8745685870fdeb0896b66", "Labels":null, "ParentId":"", "RepoDigests":["postgres@sha256:f329d076a8806c0ce014ce5e554ca70f4ae9407a16bb03baa7fef287ee6371f1"],"RepoTags":["postgres:latest"],"SharedSize":-1,"Size":353515246,"VirtualSize":353515246}]
Describe the results you expected:
I was expecting to see the Containers field to have a value of 1 instead of -1. Because there is one instance of the postgres image
When looking through the example's response the value is never -1 : here
[{"Containers":1, "Created":1641260421, "Id":"sha256:d554ff53ff5c2b0113c8e060a4a9874d5e69186d66a8745685870fdeb0896b66", "Labels":null, "ParentId":"", "RepoDigests":["postgres@sha256:f329d076a8806c0ce014ce5e554ca70f4ae9407a16bb03baa7fef287ee6371f1"],"RepoTags":["postgres:latest"],"SharedSize":-1,"Size":353515246,"VirtualSize":353515246}]
Output of docker version:
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:44:28 2021
OS/Arch: linux/arm64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:05 2021
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker info:
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:44:28 2021
OS/Arch: linux/arm64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:05 2021
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
ubuntu@cloudvm:~$ sudo docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 1
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.11.0-1027-oracle
Operating System: Ubuntu 20.04.3 LTS
OSType: linux
Architecture: aarch64
CPUs: 1
Total Memory: 5.79GiB
Name: cloudvm
ID: 34CD:VT7B:3RBJ:G34C:SJ5R:DUON:PD3Y:CWCS:UYEG:4LIO:ZHNH:OKN6
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
I'd like to try to fix it if it's a bug according to you