Bug 1702787 - podman top doesn't accept the same arguments as docker top
Summary: podman top doesn't accept the same arguments as docker top
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: podman
Version: 30
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Valentin Rothberg
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-24 18:49 UTC by Vadim Trochinsky
Modified: 2019-10-04 10:27 UTC (History)
5 users (show)

Fixed In Version: podman-1.3.1-1.git7210727.fc30 podman-1.3.1-1.git7210727.fc29
Clone Of:
Environment:
Last Closed: 2019-05-20 01:03:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vadim Trochinsky 2019-04-24 18:49:27 UTC
Description of problem:

podman top has different arguments, which means it doesn't work as a drop-in docker replacement.

Specifically, this breaks Jenkins when trying to use podman for jobs. During the job, Jenkins executes this line:

docker top [hash] -eo pid,comm

This works fine with Docker, but Podman uses an incompatible syntax, and wants this instead:

podman top [hash] pid comm



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

podman-1.2.0-2.git3bd528e.fc30.x86_64


How reproducible:

Reliably

Steps to Reproduce:
1. podman run -t -d -u 983:983 --entrypoint='' fedora cat
6e36d7ef2ffc11b04cd36844f87f2299f6b50230a6085d55a6a521af17a91346
2.  podman top 6e36d7ef2ffc11b04cd36844f87f2299f6b50230a6085d55a6a521af17a91346  -eo pid,comm
Error: unknown shorthand flag: 'e' in -eo


Actual results:

Error: unknown shorthand flag: 'e' in -eo

Expected results:

sudo docker top c2f2e928d7ed5d3d735e5645885b8463a2e4d26c82542516f6fabeba261c1863 -eo pid,comm
PID                 COMMAND
31079               cat

Additional info:

Comment 1 Daniel Walsh 2019-04-24 19:03:12 UTC
Valentin, we could just add an -e and -o options and make them be a noop to be compatible.

Comment 2 Vadim Trochinsky 2019-04-24 21:07:53 UTC
There's also the comma:

podman top 6e36d7ef2ffc11b04cd36844f87f2299f6b50230a6085d55a6a521af17a91346  pid,comm
Error: 'pid,comm': unknown descriptor


Also, if you'd like to try this with Jenkins:

1. Install Jenkins
2. Go to http://localhost:8080
3. Go to manage Jenkins -> manage Plugins -> available
4. Install Pipeline and Docker Pipeline
5. Create job with New Item -> Pipeline
6. In the pipeline script textbox, enter this:

pipeline {
    agent {
        docker {
            image 'fedora' 
        }
    }
    
    stages {
        stage("Test") {
            steps {
                sh 'echo This is working'
            }
        }
    }

}

Comment 3 Daniel Walsh 2019-04-24 21:16:09 UTC
Partial fixes here.

https://github.com/containers/libpod/pull/3006

Comment 4 Valentin Rothberg 2019-05-07 11:06:52 UTC
The issue is now fixed by https://github.com/containers/libpod/pull/3034 and will is released with Podman v1.3.0 which should be hit the packages shortly.

Comment 5 Fedora Update System 2019-05-17 17:20:29 UTC
podman-1.3.1-1.git7210727.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-fe6ef87556

Comment 6 Fedora Update System 2019-05-17 17:20:40 UTC
podman-1.3.1-1.git7210727.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-a0ddb8df76

Comment 7 Fedora Update System 2019-05-18 00:54:13 UTC
podman-1.3.1-1.git7210727.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a0ddb8df76

Comment 8 Fedora Update System 2019-05-18 04:11:26 UTC
podman-1.3.1-1.git7210727.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-fe6ef87556

Comment 9 Fedora Update System 2019-05-20 01:03:51 UTC
podman-1.3.1-1.git7210727.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2019-06-05 02:01:09 UTC
podman-1.3.1-1.git7210727.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Bruno Thomsen 2019-10-04 09:13:46 UTC
It looks like this has regressed as I am hitting the same issue with Fedora Server 30 and podman 1.5.1-3.

[jenkins@tinypenguin workspace]$ podman -v
podman version 1.5.1
[jenkins@tinypenguin workspace]$ rpm -q podman
podman-1.5.1-3.fc30.x86_64
[jenkins@tinypenguin workspace]$ cat /etc/redhat-release 
Fedora release 30 (Thirty)
[jenkins@tinypenguin workspace]$ podman run -t -d -u 1337:1337 --entrypoint='' fedora cat
8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b
[jenkins@tinypenguin workspace]$ podman top 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo pid,comm
Error: '-eo': unknown descriptor
[jenkins@tinypenguin workspace]$ podman top 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b pid comm
PID   COMMAND
1     cat

Comment 12 Valentin Rothberg 2019-10-04 10:01:42 UTC
(In reply to Bruno Thomsen from comment #11)
> It looks like this has regressed as I am hitting the same issue with Fedora
> Server 30 and podman 1.5.1-3.
> 
> [jenkins@tinypenguin workspace]$ podman -v
> podman version 1.5.1
> [jenkins@tinypenguin workspace]$ rpm -q podman
> podman-1.5.1-3.fc30.x86_64
> [jenkins@tinypenguin workspace]$ cat /etc/redhat-release 
> Fedora release 30 (Thirty)
> [jenkins@tinypenguin workspace]$ podman run -t -d -u 1337:1337
> --entrypoint='' fedora cat
> 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b
> [jenkins@tinypenguin workspace]$ podman top
> 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo pid,comm
> Error: '-eo': unknown descriptor
> [jenkins@tinypenguin workspace]$ podman top
> 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b pid comm
> PID   COMMAND
> 1     cat

Thanks for reaching out. Can you do a `podman exec 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo pid,comm`? It should fail as well. Podman falls back to executing ps(1) _inside_ the container when hitting an unsupported descriptor.

Comment 13 Bruno Thomsen 2019-10-04 10:16:38 UTC
(In reply to Valentin Rothberg from comment #12)
> > [jenkins@tinypenguin workspace]$ podman top
> > 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo pid,comm
> > Error: '-eo': unknown descriptor
> > [jenkins@tinypenguin workspace]$ podman top
> > 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b pid comm
> > PID   COMMAND
> > 1     cat
> 
> Thanks for reaching out. Can you do a `podman exec
> 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo
> pid,comm`? It should fail as well. Podman falls back to executing ps(1)
> _inside_ the container when hitting an unsupported descriptor.

Hi Valentin,

Yes, you are right.

[jenkins@tinypenguin workspace]$ podman exec 8246ef9b99a36651fe7a69776e9972b4c601b7654617adc7c5f1aeac81502e7b -eo pid,comm
Error: exec failed: container_linux.go:346: starting container process caused "exec: \"-eo\": executable file not found in $PATH": OCI runtime command not found error

So we should just make sure that our CI pipeline container contain ps (dnf install procps-ng).

Comment 14 Valentin Rothberg 2019-10-04 10:27:04 UTC
Hi Bruno,

> So we should just make sure that our CI pipeline container contain ps (dnf install procps-ng).

Yes, that should resolve your issue. But we see that podman-top isn't 100 percent compatible with docker-top as docker executes ps locally on the host.

Podman executes ps(1) in the container to keep things a bit simpler (in the code). Ultimately, we would love users to make use of the supported format descriptors [1]. There are quite a few cool features that Docker does not support, for instance, listing the seccomp mode, the selinux label, capabilities or inspecting the PID/user of the processes in the host namespace.

[1] https://github.com/containers/libpod/blob/master/docs/podman-top.1.md


Note You need to log in before you can comment on or make changes to this bug.