Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1361949

Summary: [RFE] Implement atomic ps command to support list containers
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.4CC: dwalsh, jhonce
Target Milestone: rcKeywords: Extras, FutureFeature
Target Release: ---Flags: jhonce: needinfo-
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-12-06 17:41:43 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 Alex Jia 2016-08-01 03:16:39 UTC
Description of problem:
As a atomic user, which need to switch docker and atomic command to operate a running container, we should have a unified atomic command interface to do this like atomic ps.

For now, Yuqi Zhang have implemented most of functions in the PR https://github.com/projectatomic/atomic/pull/493, but the option '--sys' hasn't been implemented yet, a trello card https://trello.com/c/3THkrLJp/251-3-add-sys-option-to-atomic-ps is used to trace the issue.

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

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

[cloud-user@atomic-00 ~]$ sudo atomic host status
State: idle
Deployments:
● rhel-atomic-host:rhel-atomic-host/7/x86_64/standard
       Version: 7.2.6 (2016-07-27 21:58:00)
        Commit: 50a33b6f64616bb4975602f16e76c74a74afc5699a94f4a0a0c8fc99ebe20367
        OSName: rhel-atomic-host
  GPGSignature: (unsigned)

[cloud-user@atomic-00 ~]$ rpm -q atomic docker
atomic-1.10.5-7.el7.x86_64
docker-1.10.3-46.el7.9.x86_64


How reproducible:
always

Steps to Reproduce:
1. atomic ps

Actual results:

[cloud-user@atomic-00 ~]$ sudo atomic ps
/bin/atomic: invalid choice: 'ps' (choose from 'diff', 'help', 'host', 'info', 'install', 'images', 'mount', 'push', 'upload', 'pull', 'scan', 'stop', 'run', 'storage', 'migrate', 'top', 'uninstall', 'unmount', 'umount', 'update', 'version', 'verify')
Try 'atomic --help' for more information.


Expected results:

Support atomic ps command and include '--sys' option

Additional info:


1. w/ --json option, the output json format string in a list, is it an expected result?
$ sudo ./atomic ps --json
[{"status": "running", "container": "725bfa05a8bf8971c5acf656cf14b97c5058bb8d787c6477c7a03234d21d8b2c", "created": "2016-07-27 03:27", "image": "registry.access.redhat.com/rhel7.2", "command": "/bin/sh", "runtime": "Docker", "type": "docker"}]

2. docs issue, please see projectatomic/atomic: Pull Request 501

3. it has a little hard to know how to use --filter option, could you add some examples into atomic-ps docs?

Comment 2 Daniel Walsh 2016-08-19 21:46:42 UTC
Fixed in atomic-1.11

Comment 4 Alex Jia 2016-09-18 04:27:01 UTC
The atomic ps command has been replaced by new atomic containers list command in atomic-1.12.0-1.el7.x86_64, and it works well to list single running container, but failed to list multiple running containers in atomic-1.12.0-1.el7.x86_64, for now, the issue has been fixed in 
 atomic-1.12.2-2.el7.x86_64.

1. in atomic-1.12.0-1.el7.x86_64

# docker run -dit busybox /bin/sh
861248a708663444bbe8fdee2350ed51b7fb64dc6147ea4f377dcd9b278c5b01

# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
861248a70866        busybox             "/bin/sh"           3 seconds ago       Up 2 seconds                            zen_perlman

# atomic containers list
   CONTAINER ID IMAGE                COMMAND              CREATED          STATUS    RUNTIME   
   861248a70866 busybox              /bin/sh              2016-09-18 04:16 running   Docker    

# docker run -dit registry.access.redhat.com/rhel7 /bin/sh
e62a3f895e1006085648267ae6a6844540f64c36ecd7382752a08e9dc98e9875

# docker ps
CONTAINER ID        IMAGE                              COMMAND             CREATED             STATUS              PORTS               NAMES
e62a3f895e10        registry.access.redhat.com/rhel7   "/bin/sh"           3 seconds ago       Up 2 seconds                            sleepy_banach
861248a70866        busybox                            "/bin/sh"           4 minutes ago       Up 4 minutes                            zen_perlman

# atomic containers list
'ImageId'

2. in the latest atomic-1.12.2-2.el7.x86_64

# atomic containers list
   CONTAINER ID IMAGE                COMMAND              CREATED          STATUS    RUNTIME   
   a2cce0707793 registry.access.redh /bin/sh              2016-09-18 04:23 running   Docker    
   8f9c1effdf8c busybox              /bin/sh              2016-09-18 04:22 running   Docker    
   56fbe2b14684 registry.access.redh /bin/sh              2016-09-18 04:22 running   Docker

Comment 5 Alex Jia 2016-09-27 22:07:55 UTC
We will get an error like 'ImageId' when the running containers are more than 2, such as 3 running containers.

[root@atomic-host-001 cloud-user]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
cb203075e312        centos/tools        "/usr/bin/bash"     26 seconds ago       Up 22 seconds                           tools
98698c836bd7        rhel7               "cat"               About a minute ago   Up 23 seconds                           jolly_mahavira
620d4a38ff73        busybox             "/bin/sh"           About a minute ago   Up About a minute                       nauseous_borg

[root@atomic-host-001 cloud-user]# atomic containers list
'ImageId'

[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

Comment 6 Alex Jia 2016-09-27 22:26:12 UTC
$ git rev-parse HEAD
61b03d3c94023e4913b05347d2b67cc2ab18c063

[root@atomic-host-001 cloud-user]# cd atomic/
[root@atomic-host-001 atomic]# ./atomic containers list
'ImageId'

[root@atomic-host-001 cloud-user]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
69664df9dd82        rhel7               "cat"               About a minute ago   Up About a minute                       kickass_hopper
cb203075e312        centos/tools        "/usr/bin/bash"     17 minutes ago       Up 17 minutes                           tools
620d4a38ff73        busybox             "/bin/sh"           19 minutes ago       Up 18 minutes                           nauseous_borg

Comment 7 Daniel Walsh 2016-09-27 22:41:08 UTC
I have opened 
https://github.com/projectatomic/atomic/pull/667

To fix this issue.

Basically this only happens if you have a vulnerable image on your system.

Comment 9 Daniel Walsh 2016-09-28 11:23:54 UTC
This feature was added and will be in RHEL7.3, there is a bug though. atomic containers list works fine, unless you have a container/image on your system which has known vulnerability.

Comment 10 Daniel Walsh 2016-10-18 16:03:08 UTC
Fixed in atomic-1.13

Comment 12 Alex Jia 2016-10-28 08:54:12 UTC
It works well for me.

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

Comment 14 errata-xmlrpc 2016-12-06 17:41:43 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-2857.html