Bug 1376600

Summary: atomic version won't work with system containers
Product: Red Hat Enterprise Linux 7 Reporter: Qian Cai <qcai>
Component: atomicAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: ajia, avagarwa, bbaude, dwalsh, giuseppe, gscrivan
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: 2016-11-04 09:07:03 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:
Embargoed:

Description Qian Cai 2016-09-15 21:41:36 UTC
Description of problem:
We really need a way to track image version for system containers like rpm -q for their counterparts.

# atomic images list
   REPOSITORY              TAG      IMAGE ID       CREATED            VIRTUAL SIZE   TYPE      
>  rhel7/flannel           latest   b67c81dd9cec   2016-09-14 14:49                  system       
>  rhel7/etcd              latest   ba648b580c2a   2016-09-14 19:14                  system    
>  rhel7/etcd3             latest   952d875b7808   2016-09-14 18:16                  system    
   rhel7/etcd-2.3.7        8        7ebe798bd215   2016-09-14 14:48                  system

# atomic version rhel7/etcd-2.3.7
g-io-error-quark: Refspec 'ociimage/7ebe798bd215024d20658f7f39394868647e08bf73bf9b1f5aaf8991bc489a11-latest' not found (1)

# atomic version rhel7/flannel
Image Name: rhel7/flannel
/bin/atomic version rhel7/flannel: too few arguments
Try '/bin/atomic version rhel7/flannel --help' for more information.

# atomic version c92f496bd9f0
Image Name: c92f496bd9f0
/bin/atomic version c92f496bd9f0: too few arguments
Try '/bin/atomic version c92f496bd9f0 --help' for more information.

# atomic version rhel7/etcd
Image Name: rhel7/etcd
/bin/atomic version rhel7/etcd: too few arguments
Try '/bin/atomic version rhel7/etcd --help' for more information.

# atomic version rhel7/etcd3
Image Name: rhel7/etcd3
/bin/atomic version rhel7/etcd3: too few arguments

Version-Release number of selected component (if applicable):
atomic-1.12.1-3.el7.x86_64

How reproducible:
always

Comment 1 Qian Cai 2016-09-16 16:17:02 UTC
Without this, the only viable workaround I can find so far is to start another process inside the running container to obtain the version information.

# runc exec etcd etcd --version

Comment 2 Alex Jia 2016-09-19 05:09:57 UTC
The same issue to non-system containers in atomic-1.12.2-2.el7.x86_64.

[cloud-user@atomic-host-001 ~]$ rpm -q atomic
atomic-1.12.2-2.el7.x86_64

[cloud-user@atomic-host-001 ~]$ sudo atomic version
atomic version: too few arguments
Try 'atomic version --help' for more information.

[cloud-user@atomic-host-001 ~]$ sudo atomic version docker.io/busybox
Image Name: docker.io/busybox
/bin/atomic version docker.io/busybox: too few arguments
Try '/bin/atomic version docker.io/busybox --help' for more information.

[cloud-user@atomic-host-001 ~]$ sudo atomic version -r docker.io/busybox
Image Name: docker.io/busybox
/bin/atomic version -r docker.io/busybox: too few arguments
Try '/bin/atomic version -r docker.io/busybox --help' for more information.

[cloud-user@atomic-host-001 ~]$ sudo atomic version --help
usage: atomic version [-h] [-r] image

positional arguments:
  image          container image

optional arguments:
  -h, --help     show this help message and exit
  -r, --recurse  recurse through all layers

atomic version displays the image version information, if it is provided

Comment 3 Alex Jia 2016-09-19 05:45:08 UTC
(In reply to Alex Jia from comment #2)
> The same issue to non-system containers in atomic-1.12.2-2.el7.x86_64.

s/non-system/non-RHEL/.

Comment 4 Giuseppe Scrivano 2016-09-19 21:23:27 UTC
PR upstream: https://github.com/projectatomic/atomic/pull/634

Comment 6 Alex Jia 2016-09-20 10:06:25 UTC
This bug has been fixed on atomic-1.12.2-3.el7.x86_64.

[cloud-user@atomic-00 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Atomic Host release 7.2

[cloud-user@atomic-00 ~]$ atomic host status
State: idle
Deployments:
● rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard
       Version: 7.2.6-1 (2016-08-18 16:01:03)
        Commit: dae35767902aad07b087d359be20f234d244da79fdd4734cd2fbc3ee39b12cf8
        OSName: rhel-atomic-host
      Unlocked: development

[cloud-user@atomic-00 ~]$ rpm -q atomic
atomic-1.12.2-3.el7.x86_64

[cloud-user@atomic-00 ~]$ sudo atomic version registry.access.redhat.com/rhel7/etcd:2.3.7
Image Name: registry.access.redhat.com/rhel7/etcd:2.3.7
distribution-scope: public
build-date: 2016-09-08T10:38:28.972667Z
RUN: /usr/bin/docker run -d $OPT1 -p 4001:4001 -p 7001:7001 -p 2379:2379 -p 2380:2380 --name $NAME $IMAGE $OPT2 $OPT3
Name: rhel7/etcd
Build_Host: rcm-img-docker02.build.eng.bos.redhat.com
vcs-type: git
architecture: x86_64
Summary: A highly-available key value store for shared configuration
vcs-ref: 37c024f260707c2b0c017345fd99aae8b2dd2747
release: 104
Version: 2.3.7
Architecture: x86_64
INSTALL: /usr/bin/docker run --rm $OPT1 --privileged -v /:/host -e HOST=/host -e NAME=$NAME -e IMAGE=$IMAGE $IMAGE $OPT2 /usr/bin/install.sh  $OPT3
Release: 5
Vendor: Red Hat, Inc.
BZComponent: etcd-docker
Authoritative_Registry: registry.access.redhat.com
com.redhat.build-host: rcm-img-docker02.build.eng.bos.redhat.com
UNINSTALL: /usr/bin/docker run --rm $OPT1 --privileged -v /:/host -e HOST=/host -e NAME=$NAME -e IMAGE=$IMAGE $IMAGE $OPT2 /usr/bin/uninstall.sh $OPT3

[cloud-user@atomic-00 ~]$ sudo atomic version registry.access.redhat.com/rhel7/etcd:latest
Image Name: registry.access.redhat.com/rhel7/etcd:latest
distribution-scope: public
build-date: 2016-09-08T10:38:28.972667Z
RUN: /usr/bin/docker run -d $OPT1 -p 4001:4001 -p 7001:7001 -p 2379:2379 -p 2380:2380 --name $NAME $IMAGE $OPT2 $OPT3
Name: rhel7/etcd
Build_Host: rcm-img-docker02.build.eng.bos.redhat.com
vcs-type: git
architecture: x86_64
Summary: A highly-available key value store for shared configuration
vcs-ref: 37c024f260707c2b0c017345fd99aae8b2dd2747
release: 104
Version: 2.3.7
Architecture: x86_64
INSTALL: /usr/bin/docker run --rm $OPT1 --privileged -v /:/host -e HOST=/host -e NAME=$NAME -e IMAGE=$IMAGE $IMAGE $OPT2 /usr/bin/install.sh  $OPT3
Release: 5
Vendor: Red Hat, Inc.
BZComponent: etcd-docker
Authoritative_Registry: registry.access.redhat.com
com.redhat.build-host: rcm-img-docker02.build.eng.bos.redhat.com
UNINSTALL: /usr/bin/docker run --rm $OPT1 --privileged -v /:/host -e HOST=/host -e NAME=$NAME -e IMAGE=$IMAGE $IMAGE $OPT2 /usr/bin/uninstall.sh $OPT3

Comment 8 errata-xmlrpc 2016-11-04 09:07:03 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://rhn.redhat.com/errata/RHBA-2016-2628.html