Why the images information provided by docker info is different from docker images

Hi I’m trying to extract the number of docker images I have in my machine

If I run the command docker info it gives me this:

  • Pass AWS credentials (IAM role credentials) to code running in docker container
  • Starting Mesos slave in Docker on Amazon Linux results in cgroup error
  • Gitlab CI: Persist MySQL data between stages
  • Understanding docker - how do containers contain all required dependencies?
  • “rsync” was not detected as installed in your guest machine
  • How can I attach to docker container running in detached mode?
  • Containers: 15
    Images: 27
    Driver: aufs
     Root Dir: /var/lib/docker/aufs
     Dirs: 57
    Username: miggom
    Registry: [https://index.docker.io/v1/]
    WARNING: No swap limit support
    

    If I run the command docker images -a it gives me this:

    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    <none>              <none>              2b1cf54887a8        20 minutes ago      139.5 MB
    <none>              <none>              14e148a673c8        3 hours ago         204.4 MB
    <none>              <none>              bf3d7d4f575d        13 days ago         273.9 MB
    <none>              <none>              c3553dd60b1e        13 days ago         273.9 MB
    mgs/my-site         latest              268ffd69fb60        13 days ago         273.9 MB
    miggom/mySite       latest              268ffd69fb60        13 days ago         273.9 MB
    my-site             latest              268ffd69fb60        13 days ago         273.9 MB
    mgsMySite           latest              268ffd69fb60        13 days ago         273.9 MB
    mgs_mySite          latest              268ffd69fb60        13 days ago         273.9 MB
    <none>              <none>              b055dfd3f223        13 days ago         273.9 MB
    apache2             latest              826c4bc6368a        2 weeks ago         273.9 MB
    <none>              <none>              7aa770719eb1        2 weeks ago         273.9 MB
    <none>              <none>              1850570b7316        2 weeks ago         273.9 MB
    <none>              <none>              44943615dd35        2 weeks ago         273.9 MB
    <none>              <none>              994c3e50a608        2 weeks ago         273.9 MB
    <none>              <none>              a97583e98230        2 weeks ago         273.9 MB
    <none>              <none>              635d880c0c38        2 weeks ago         273.9 MB
    <none>              <none>              b8735e7272ef        2 weeks ago         224.3 MB
    baselDaemon         latest              4e892058b0b2        2 weeks ago         204.4 MB
    ubuntu              saucy               9f676bd305a4        4 weeks ago         178 MB
    ubuntu              13.10               9f676bd305a4        4 weeks ago         178 MB
    <none>              <none>              1c7f181e78b9        4 weeks ago         0 B
    ubuntu              13.04               eb601b8965b8        4 weeks ago         166.5 MB
    ubuntu              raring              eb601b8965b8        4 weeks ago         166.5 MB
    <none>              <none>              f323cf34fd77        4 weeks ago         0 B
    ubuntu              12.10               5ac751e8d623        4 weeks ago         161 MB
    ubuntu              quantal             5ac751e8d623        4 weeks ago         161 MB
    <none>              <none>              321f7f4200f4        4 weeks ago         0 B
    ubuntu              10.04               9cc9ea5ea540        4 weeks ago         180.8 MB
    ubuntu              lucid               9cc9ea5ea540        4 weeks ago         180.8 MB
    ubuntu              precise             9cd978db300e        4 weeks ago         204.4 MB
    ubuntu              12.04               9cd978db300e        4 weeks ago         204.4 MB
    ubuntu              latest              9cd978db300e        4 weeks ago         204.4 MB
    <none>              <none>              6170bb7b0ad1        4 weeks ago         0 B
    <none>              <none>              7a4f87241845        5 weeks ago         0 B
    <none>              <none>              511136ea3c5a        8 months ago        0 B
    learn/tutorial      latest              8dbd9e392a96        10 months ago       128 MB
    

    So, the problem is that the number of the images shown in docker info doesn’t match with the number of images shown in docker images. I don’t know how to get the correct number of images beacuse if you also execute the docker images without flags, it doesn’t match with the number of images shown in docker info

    I don’t know which type of information I can get from docker info because in docker.io there is just an example of the documentation.

    Thank you in advance

  • What's a safe minimum disk size for a production Kubernetes node?
  • Starting Docker Container With Different Parameters
  • Connecting an Oracle DB Container and a Java application Container (Docker)
  • docker service create doesn't find image
  • Asked password when ssh to container
  • Cross-compile using go build CGO_ENABLED - warning: libudev.so.1 not found
  • 2 Solutions collect form web for “Why the images information provided by docker info is different from docker images”

    The point here is not whether an image is flagged or not. Take note of the Image ID when you count the images. Several (differently tagged) images with the same ID count as one image, because well… they are the same image 🙂

    If I manually count the different IDs, I find 27.

    A lot of those images are intermediary images and are used for caching when you want to rebuild your Dockerfile.

    By default when you run docker images it hides these intermediate images, but if you pass the -a argument it’ll show them all

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.