Bug 1383242

Summary: Filters the output doesn't work very well in atomic images
Product: Red Hat Enterprise Linux 7 Reporter: Alex Jia <ajia>
Component: atomicAssignee: Brent Baude <bbaude>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: amurdaca, dwalsh, jerzhang, lsm5
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-28 15:41:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alex Jia 2016-10-10 09:39:00 UTC
Description of problem:
Filters the output doesn't work very well in atomic images, for example, to filter dangling images in atomic.

Version-Release number of selected component (if applicable):

[root@atomic-host-001 cloud-user]# cat /etc/redhat-release 
Red Hat Enterprise Linux Atomic Host release 7.3

[root@atomic-host-001 cloud-user]# rpm -q atomic docker
atomic-1.12.5-2.el7.x86_64
docker-1.10.3-55.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. docker pull some images
2. docker images -f dangling=true
3. atomic images list -f dangling=true

Actual results:

[root@atomic-host-001 cloud-user]# docker images --filter dangling=true
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

[root@atomic-host-001 cloud-user]# docker images --filter dangling=false
REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
docker.io/busybox                  latest              e02e811dd08f        2 days ago          1.093 MB
registry.access.redhat.com/rhel7   latest              98a88a8b722a        4 weeks ago         201.4 MB

[root@atomic-host-001 cloud-user]# atomic images list --filter dangling=true
   REPOSITORY                         TAG      IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   docker.io/busybox                  latest   e02e811dd08f   2016-10-07 21:03   1.09 MB        Docker    
   registry.access.redhat.com/rhel7   latest   98a88a8b722a   2016-09-06 18:23   201.38 MB      Docker 


Expected results:
fix it.

Additional info:

Comment 2 Yu Qi Zhang 2016-10-11 14:48:09 UTC
As a note, this is due to "dangling" not being handled as a filter.

Originally this was modeled after "docker ps", which handles non-filterables by defaulting everything to go through:

# docker ps -a -f asdf=asdf
CONTAINER ID        IMAGE                   COMMAND             CREATED             STATUS                   PORTS               NAMES
37fa1558e905        ef794809c68b            "/bin/bash"         5 weeks ago         Exited (0) 5 weeks ago                       sick_turing

Interestingly this is different for "docker images" which errors:

# docker images -f asdf=asdf
Error response from daemon: Invalid filter 'asdf'

Comment 3 Daniel Walsh 2016-10-18 17:41:01 UTC
Brent is this fixed in atomic-1.13?

Comment 4 Brent Baude 2016-10-18 19:15:09 UTC
I was able to fix the omission of the dangling filter with https://github.com/projectatomic/atomic/pull/715 .

We will not be able to emulate docker's filtering with images as it involves a deeper analysis and use of labels, which systemcontainers does not do right now.

Comment 5 Daniel Walsh 2016-10-18 19:28:38 UTC
Fixed in atomic-1.13.2

Comment 7 Alex Jia 2016-10-28 09:14:25 UTC
[root@atomic-host-001 cloud-user]# atomic images list -f asdf=asdf
   REPOSITORY                                  TAG      IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   centos_apache                               latest   aa68565dba0f   2016-10-28 09:03   338.5 MB       Docker    
   label_centos                                latest   fd3f10960e86   2016-10-28 08:59   196.74 MB      Docker    
>  docker.io/busybox                           latest   e02e811dd08f   2016-10-07 21:03   1.09 MB        Docker    
   registry.access.redhat.com/rhel7/openscap   latest   fe6f007ba9df   2016-09-08 19:10   362.79 MB      Docker    
   docker.io/centos                            latest   980e0e4c79ec   2016-09-06 21:10   196.74 MB      Docker 

[root@atomic-host-001 cloud-user]# docker images -f asdf=asdf
Error response from daemon: Invalid filter 'asdf'

[root@atomic-host-001 cloud-user]# atomic host status
State: idle
Deployments:
● rhel-atomic-host:rhel-atomic-host/7/x86_64/standard
       Version: 7.3 (2016-10-26 14:24:09)
        Commit: 90c9735becfff1c55c8586ae0f2c904bc0928f042cd4d016e9e0e2edd16e5e97
        OSName: rhel-atomic-host
  GPGSignature: (unsigned)
      Unlocked: development

[root@atomic-host-001 cloud-user]# rpm -q atomic docker
atomic-1.13.3-1.el7.x86_64
docker-1.10.3-57.el7.x86_64

Comment 10 Alex Jia 2017-06-19 01:08:37 UTC
[root@dell-per630-02 ~]# rpm -q atomic skopeo docker
atomic-1.18.1-2.1.git0705b1b.el7.x86_64
skopeo-0.1.20-2.el7.x86_64
docker-1.12.6-30.1.git1398f24.el7.x86_64

There are some changes for atomic images commands, for now, the filter options are fine for ['repo', 'repository', 'tag', 'id', 'created', 'type', 'is_dangling'], but 'image' and 'size' doesn't work, I will file a new bugs for track this, because users can find specified image using other filter options.



[root@dell-per630-02 ~]# atomic images list
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   registry.access.stage.redhat.com/rhel7-init                                         latest                                            9c2ae8e5eae1   2017-06-08 20:50   194.18 MB      docker    
   skopeobuildimage                                                                    latest                                            bf727b561fad   2017-05-26 11:20   642.95 MB      docker    
   registry.access.redhat.com/rhel7/rhel-tools                                         latest                                            4bc4f634f159   2017-05-19 17:17   1.4 GB         docker    
   docker.io/ubuntu                                                                    16.04                                             ebcd9d4fca80   2017-05-16 00:43   117.91 MB      docker    
   jhonce/rhel7-container-engine-docker                                                extras-rhel-7.3-docker-candidate-20170509192013   a44de4392490   2017-05-10 07:23   345.54 MB      docker    
   registry.access.redhat.com/rhscl/myhttpd-24-rhel7                                   latest                                            e047438ddd0f   2017-04-10 15:52   485.63 MB      docker    
   docker.io/httpd                                                                     latest                                            278cd55ca6c5   2017-03-22 04:50   176.9 MB       docker    
   10.11.22.33:5000/mybusybox                                                          latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   registry.access.redhat.com/rhel7/rhel-atomic                                        latest                                            c8833d5bce74   2017-03-09 06:32   75.33 MB       docker    
   registry.access.redhat.com/rhel7/cockpit-ws                                         latest                                            f9ad4e398a3c   2017-02-28 00:07   209.81 MB      docker    
   registry.access.redhat.com/rhscl/httpd-24-rhel7                                     latest                                            533e496998ca   2017-02-23 21:17   438.0 MB       docker    
*  <none>                                                                              <none>                                            654d9067c62d   2016-12-05 20:01   209.81 MB      docker    
   docker.io/centos                                                                    latest                                            0584b3d2cf6d   2016-11-03 03:52   196.51 MB      docker    
*  <none>                                                                              <none>                                            e8d27ce9a753   2016-10-31 20:32   1.37 GB        docker    
   registry.access.redhat.com/rhel7/sssd                                               latest                                            74eacb72309b   2016-10-29 05:46   357.25 MB      docker    
   registry.access.redhat.com/rhel7                                                    latest                                            f98706e16e41   2016-10-26 20:02   192.51 MB      docker    
   brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/rhel7/container-engine         1.12-9                                            5514724b44e1   2017-05-26 08:08                  ostree    
   brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/openshift3/openshift-ansible   v3.6                                              5fff623942c4   2017-05-27 19:28                  ostree   

1. for ['image', 'size'] option

[root@dell-per630-02 ~]# atomic images list -f size="1.4 GB"
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
[root@dell-per630-02 ~]# atomic images list -f image=busybox
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE       



2. for ['repo', 'repository', 'tag', 'id', 'created', 'type', 'is_dangling'] options


[root@dell-per630-02 ~]# atomic images list -f id=9c2ae8e5eae1
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   registry.access.stage.redhat.com/rhel7-init                                         latest                                            9c2ae8e5eae1   2017-06-08 20:50   194.18 MB      docker    


[root@dell-per630-02 ~]# atomic images list -f repo=docker.io/busybox
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
[root@dell-per630-02 ~]# atomic images list -f repo=busybox

   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   10.11.22.33:5000/mybusybox                                                          latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
[root@dell-per630-02 ~]# 
[root@dell-per630-02 ~]# atomic images list -f repo=docker.io
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   docker.io/ubuntu                                                                    16.04                                             ebcd9d4fca80   2017-05-16 00:43   117.91 MB      docker    
   docker.io/httpd                                                                     latest                                            278cd55ca6c5   2017-03-22 04:50   176.9 MB       docker    
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   docker.io/centos                                                                    latest                                            0584b3d2cf6d   2016-11-03 03:52   196.51 MB      docker    

[root@dell-per630-02 ~]# atomic images list -f repository=busybox
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   10.11.22.33:5000/mybusybox                                                          latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
[root@dell-per630-02 ~]# atomic images list -f tag=latest
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   registry.access.stage.redhat.com/rhel7-init                                         latest                                            9c2ae8e5eae1   2017-06-08 20:50   194.18 MB      docker    
   skopeobuildimage                                                                    latest                                            bf727b561fad   2017-05-26 11:20   642.95 MB      docker    
   registry.access.redhat.com/rhel7/rhel-tools                                         latest                                            4bc4f634f159   2017-05-19 17:17   1.4 GB         docker    
   registry.access.redhat.com/rhscl/myhttpd-24-rhel7                                   latest                                            e047438ddd0f   2017-04-10 15:52   485.63 MB      docker    
   docker.io/httpd                                                                     latest                                            278cd55ca6c5   2017-03-22 04:50   176.9 MB       docker    
   10.11.22.33:5000/mybusybox                                                          latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   docker.io/busybox                                                                   latest                                            00f017a8c2a6   2017-03-10 02:28   1.11 MB        docker    
   registry.access.redhat.com/rhel7/rhel-atomic                                        latest                                            c8833d5bce74   2017-03-09 06:32   75.33 MB       docker    
   registry.access.redhat.com/rhel7/cockpit-ws                                         latest                                            f9ad4e398a3c   2017-02-28 00:07   209.81 MB      docker    
   registry.access.redhat.com/rhscl/httpd-24-rhel7                                     latest                                            533e496998ca   2017-02-23 21:17   438.0 MB       docker    
   docker.io/centos                                                                    latest                                            0584b3d2cf6d   2016-11-03 03:52   196.51 MB      docker    
   registry.access.redhat.com/rhel7/sssd                                               latest                                            74eacb72309b   2016-10-29 05:46   357.25 MB      docker    
   registry.access.redhat.com/rhel7                                                    latest                                            f98706e16e41   2016-10-26 20:02   192.51 MB      docker    
[root@dell-per630-02 ~]# atomic images list -f tag=v3.6
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/openshift3/openshift-ansible   v3.6                                              5fff623942c4   2017-05-27 19:28                  ostree    

[root@dell-per630-02 ~]# atomic images list -f type=ostree
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/rhel7/container-engine         1.12-9                                            5514724b44e1   2017-05-26 08:08                  ostree    
   brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/openshift3/openshift-ansible   v3.6                                              5fff623942c4   2017-05-27 19:28                  ostree   

[root@dell-per630-02 ~]# atomic images list -f is_dangling=True
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
*  <none>                                                                              <none>                                            654d9067c62d   2016-12-05 20:01   209.81 MB      docker    
*  <none>                                                                              <none>                                            e8d27ce9a753   2016-10-31 20:32   1.37 GB        docker 

[root@dell-per630-02 ~]# atomic images list -f created=2017-06-08
   REPOSITORY                                                                          TAG                                               IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
   registry.access.stage.redhat.com/rhel7-init                                         latest                                            9c2ae8e5eae1   2017-06-08 20:50   194.18 MB      docker

Comment 12 errata-xmlrpc 2017-06-28 15:41:26 UTC
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.

https://access.redhat.com/errata/RHBA-2017:1627