Moby: docker images reports same image in differing order

Created on 12 Aug 2016  路  1Comment  路  Source: moby/moby

Running sudo docker images results in an unpredictable and changing listing order for the multiply tagged docker image.

Output of docker version:

Client:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 22:00:36 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 22:00:36 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 25
 Running: 1
 Paused: 0
 Stopped: 24
Images: 80
Server Version: 1.12.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 177
 Dirperm1 Supported: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 3.13.0-92-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.62 GiB
Name: myhost
ID: WS4V:2MWJ:IWFT:AV5C:74U2:PPJB:G36B:5E3N:E3NR:OAW6:EERM:CKNW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

physical

Steps to reproduce the issue:

_1_. create an empty directory for context

mkdir /tmp/my-docker

_2_. create file /tmp/my-docker/Dockerfile with contents

FROM ubuntu:trusty
# add a layer for sake of example
RUN apt-get update && apt-get install -y apt-utils

_3_. build a new docker instance with multiple tags

sudo docker build -t tag1 -t tag2 .

_4_. watch the output of docker images

sudo -- watch -d -- docker images

Describe the results you received:

Running sudo docker images results in an unpredictable and changing listing order for the same docker image. Sometimes the output was

REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
tag1                            latest              e8cb1537535d        3 minutes ago       210.1 MB
tag2                            latest              e8cb1537535d        3 minutes ago       210.1 MB

then other times

REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
tag2                            latest              e8cb1537535d        3 minutes ago       210.1 MB
tag1                            latest              e8cb1537535d        3 minutes ago       210.1 MB

Describe the results you expected:

Running sudo docker images results in a predictable and consistent listing order. By Created time and then tagging order and then ...

Additional information you deem important (e.g. issue happens only occasionally):

This did not happen with the prior version of docker which I believe was version 1.10.

arecli kinenhancement versio1.12

Most helpful comment

Actually this is not only about images command, if we look at the stats command, if has similar problem.

For example, if you run docker stats -a, the output order looks consistent to docker ps -a results. Then if you start a new container, the new container will be appended at tail of the output list, it's not consistent to docker stats -a results any more.

I am working on a new flag "--sort-by" for images and ps, but I hope I can expand it to other commands.

>All comments

Actually this is not only about images command, if we look at the stats command, if has similar problem.

For example, if you run docker stats -a, the output order looks consistent to docker ps -a results. Then if you start a new container, the new container will be appended at tail of the output list, it's not consistent to docker stats -a results any more.

I am working on a new flag "--sort-by" for images and ps, but I hope I can expand it to other commands.

Was this page helpful?
0 / 5 - 0 ratings