Bug 1304808 - docker info reports wrong image count
docker info reports wrong image count
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker (Show other bugs)
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: smahajan@redhat.com
: Documentation, EasyFix, Extras
Depends On:
  Show dependency treegraph
Reported: 2016-02-04 11:48 EST by Chris Evich
Modified: 2016-06-23 12:17 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The numer of images installed in a docker environment is being reported incorrectly in the docker info command. Consequence: Bad data. Fix: Report the correct number of images. Result:
Story Points: ---
Clone Of:
Last Closed: 2016-06-23 12:17:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Chris Evich 2016-02-04 11:48:01 EST
Description of problem:
Unless I'm doing something incredibly stupid yet not obvious.

Version-Release number of selected component (if applicable):
# rpm -q docker
# docker version
 Version:      1.8.2-el7
 API version:  1.20
 Package Version: docker-1.8.2-10.el7.x86_64
 Go version:   go1.4.2
 Git commit:   a01dc02/1.8.2
 OS/Arch:      linux/amd64

 Version:      1.8.2-el7
 API version:  1.20
 Package Version: 
 Go version:   go1.4.2
 Git commit:   a01dc02/1.8.2
 OS/Arch:      linux/amd64

How reproducible:
Mostly trivial, may help to have a bunch of images and at least one container running (untested).

Steps to Reproduce:
1. docker images --all | tail -n +1 | wc -l
2. docker info | grep 'Images'

Actual results:
54 != 51
(actual value may vary)

Expected results:
54 == 54
(actual value may vary)

Additional info:
I'll check newer builds in a second...
Comment 2 Chris Evich 2016-02-04 12:54:31 EST
This appears fixed in/before 1.9.1-el7, still testing...
Comment 3 Chris Evich 2016-02-04 13:32:18 EST
okay, reproduced on 1.9.1 and there is one mistake I made, should be tail -n +2  
Corrected repro. steps:

0. # docker info
   confirm 'Images: 0'
1. Make a bunch of images
   # for n in `seq 1 20`; do for img in rhel sadc rsyslog; do docker run registry.access.redhat.com/rhel7/$img echo $RANDOM; docker run docker.io/rhel7/$img echo $RANDOM; done; done
   # for cid in `docker ps -aq`; do docker commit $cid; done
2. # docker images --all | tail -n +2 | wc -l
   shows 66
3. # docker info | grep Images
   shows Images: 63

Found I could only repro. this if I grabbed duplicate images w/ different names.  If I only grab 4.e.g. from docker.io, then the counts are correct.
Comment 4 smahajan@redhat.com 2016-02-06 13:53:12 EST
Hi Chris,

When you do `docker info` SystemInfo (https://github.com/docker/docker/blob/master/daemon/info.go#L26) method is called, which gets the images count from imageStore.


This map returns information about the images. (Tags are not part of this store).
Hence when you do `docker images --all|wc -l` you see a different count as tags are also included in the output.

Hope that clears up the confusion.

Comment 5 Chris Evich 2016-02-08 15:44:47 EST
Okay, that makes sense for 'how' it's happening.  Next step is, will any consumers (including humans) of this 'docker info' data, care?

Is this documented anywhere?  (Otherwise we're relying on someone struggling with this, to find this bug in a google search :)  

Otherwise, yeah it's probably fine to close this.  I can't think of any reason except for documentation how this could have a negative affect.

As for testing, I'll do something like this instead:

docker images --all --quiet | sort -u | wc -l
Comment 6 Chris Evich 2016-02-12 09:36:04 EST
Okay, just checked.  The man-page for 'docker info' is in need of some love.  Clarifying the 'Images' and 'Containers' count with what they actually represent would be 'nice to have'.  On F22, it has this blurb:

This  command  displays  system  wide information regarding the Docker installation. Information displayed includes the number of containers and images, pool name,  data file,  metadata file, data space used, total data space, metadata space used , total metadata space, execution driver, and the kernel version.

and the example section is really out of date (OS: Ubuntu 14 and Kernel 3.13).  Would make the guys in marketing happier if it showed Fedora/CentOS/RHEL instead and maybe showed the typical devicemapper details instead of aufs (not used any more, anywhere IIRC).

Here's a suggestion for the description blurb:

This  command  displays  system  wide information regarding the Docker installation. Information displayed includes the number of containers and (non-tagged) images, pool name,  image storage details, space available and used, execution driver, OS and the kernel versions.
Comment 8 smahajan@redhat.com 2016-02-29 09:37:19 EST
Issue opened upstream.

Will open a docs PR upstream for this.

Comment 9 smahajan@redhat.com 2016-03-14 14:37:04 EDT
PR Opened upstream.


Comment 10 smahajan@redhat.com 2016-05-04 15:26:54 EDT
New PR opened and merged upstream.

Will be available in Docker 1.12.

Comment 11 Chris Evich 2016-05-05 12:43:44 EDT
Nice! Thanks Shishir!
Comment 13 Luwen Su 2016-06-11 13:13:59 EDT
In docker-1.10.3-40.el7.x86_64, checked the man page and
the info looks like this:

#docker info
Containers: 5
 Running: 1
 Paused: 0
 Stopped: 4
Images: 4
Server Version: 1.10.3
Storage Driver: devicemapper
 Pool Name: docker-253:3-68819104-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 685.3 MB
 Data Space Total: 107.4 GB
 Data Space Available: 16.02 GB
 Metadata Space Used: 1.401 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.146 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2015-12-01)
Execution Driver: native-0.2
Logging Driver: journald
 Volume: local
 Network: bridge null host
 Authorization: rhel-push-plugin
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 2
Total Memory: 992.8 MiB
Name: myregistrydomain.com
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Registries: registry.access.redhat.com (secure), docker.io (secure)
Comment 15 errata-xmlrpc 2016-06-23 12:17:50 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.