GithubHelp home page GithubHelp logo

containers / python-podman Goto Github PK

View Code? Open in Web Editor NEW
50.0 17.0 19.0 169 KB

Python bindings and code examples for using Varlink access to Podman Service

License: Apache License 2.0

Makefile 0.94% Python 93.67% Shell 5.38%

python-podman's Introduction

podman - pythonic library for working with varlink interface to Podman

Build Status PyPI PyPI - Python Version PyPI - Status

Status: Deprecated

See podman-py

Overview

Python podman library.

Provide a stable API to call into.

Notice: The varlink interface to Podman is currently deprecated and in maintenance mode. Podman version 2.0 was released in June 2020, including a fully supported REST API that replaces the varlink interface. The varlink interface is being removed from Podman at the 3.0 release. Python support for the 2.0 REST API is in the python-py repository. The documentation for the REST API resides here.

Releases

Requirements

Install

From pypi

Install python-podman to the standard location for third-party Python modules:

python3 -m pip install podman

To use this method on Unix/Linux system you need to have permission to write to the standard third-party module directory.

Else, you can install the latest version of python-podman published on pypi to the Python user install directory for your platform. Typically ~/.local/. (See the Python documentation for site.USER_BASE for full details.) You can install like this by using the --user option:

python3 -m pip install --user podman

This method can be useful in many situations, for example, on a Unix system you might not have permission to write to the standard third-party module directory. Or you might wish to try out a module before making it a standard part of your local Python installation. This is especially true when upgrading a distribution already present: you want to make sure your existing base of scripts still works with the new version before actually upgrading.

For further reading about how python installation works you can read this documentation.

By building from source

To build the podman egg and install as user:

cd ~/python-podman
python3 setup.py clean -a && python3 setup.py sdist bdist
python3 setup.py install --user

Code snippets/examples:

Show images in storage

import podman

with podman.Client() as client:
  list(map(print, client.images.list()))

Show containers created since midnight

from datetime import datetime, time, timezone

import podman

midnight = datetime.combine(datetime.today(), time.min, tzinfo=timezone.utc)

with podman.Client() as client:
    for c in client.containers.list():
        created_at = podman.datetime_parse(c.createdat)

        if created_at > midnight:
            print('Container {}: image: {} created at: {}'.format(
                c.id[:12], c.image[:32], podman.datetime_format(created_at)))

python-podman's People

Contributors

4383 avatar afbjorklund avatar baude avatar bmarlow avatar jonathanunderwood avatar jwhonce avatar phadated avatar rhatdan avatar tomsweeneyredhat avatar williamjmorenor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-podman's Issues

Container Exec

The ExecContainer varlink method is not available in the API.

No option to publish ports on pod

Looking at the varlink schema, there's an option to set the published ports when creating a pod.

https://github.com/containers/libpod/blob/9758a975e67bb9d681d351aea0d858ace598dcdf/cmd/podman/varlink/io.podman.varlink#L451-L460

This library doesn't seem to expose that.

def create(self,
ident=None,
cgroupparent=None,
labels=None,
share=None,
infra=False):
"""Create a new empty pod."""
config = ConfigDict(
name=ident,
cgroupParent=cgroupparent,
labels=labels,
share=share,
infra=infra,
)
with self._client() as podman:
result = podman.CreatePod(config)
details = podman.GetPod(result['pod'])
return Pod(self._client, result['pod'], details['pod'])

pypodman export: ">" does NOT work

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
">" has the same functionality as -o/--output option to export container to a tar archive. podman can do it successfully, but pypodman not.

Steps to reproduce the issue:
On Remote:
podman varlink socket is started, and there's already a container existing:

[root@rhel8-1 ~]# podman ps -a
CONTAINER ID   IMAGE                             COMMAND     CREATED          STATUS                      PORTS   NAMES         IS INFRA
79dde10d5d87   docker.io/library/fedora:latest   /bin/bash   21 minutes ago   Exited (0) 21 minutes ago           test-export   false

On Host:

  1. ~/.local/bin/pypodman -l root --host 192.168.122.213 export > fedora-ctn.tar test-export

Describe the results you received:

[root@localhost libpod]# ~/.local/bin/pypodman -l root --host 192.168.122.213 export > fedora-ctn.tar test-export
2018-11-27 16:32:28 CST | ERROR    | pypodman export: the following arguments are required: --output/-o
2018-11-27 16:32:28 CST | ERROR    | Try 'pypodman export --help' for more information.

Describe the results you expected:
On remote, podman export > fedora-ctn.tar test-export can export the container test-export properly.

pypodman search: output should add a column to show the `index` as podman does

Is this a BUG REPORT or FEATURE REQUEST?:

kind feature

Description
INDEX column is important information to let users know where the images come from. podman search has this column, but pypodman does not. And NAME column should have the registry location part.

Steps to reproduce the issue:
On remote

[root@rhel8-1 ~]# podman search --filter is-official=True alpine
INDEX       NAME                       DESCRIPTION                                       STARS   OFFICIAL   AUTOMATED
docker.io   docker.io/library/alpine   A minimal Docker image based on Alpine Linux...   4803    [OK]

Describe the results you received:
On host:

root@localhost libpod]# pypodman -l root --host 192.168.122.213 search --filter is-official=True alpine
NAME                                         DESCRIPTION                                  STARS OFFICIAL AUTOMATED
alpine                                       A minimal Docker image based on Alpine Linux 4803  [OK]

Describe the results you expected:
On the host, pypodman searchshould have the INDEX column as well, and NAME column should include the registry location.

containers.list() gathers too much data


I'm facing an issue with the simplest possible API call that I could think about

with podman.Client() as client:
...: list(client.containers.list())

which on my setup, with one single container running, takes in the 2 minutes


This issue was first opened in the plain podman repo
containers/podman#4656

in that issue we have established that this mundane API call actually gathers information about disk space, which in this particular instance I do not need at all, but that slows things down terribly; the fact that 2 minutes are needed here is clearly a concern too, but should be taken separately


bottom line, I would like to know if there is currently a way to quickly obtain a simple list of containers, with minimal - even if quite incomplete - attached information;

Cannot create container from untagged image

Traceback (most recent call last):
  File "/home/astraluma/.virtualenvs/mc/podcraft/bin/podcraft", line 11, in <module>
    load_entry_point('podcraft', 'console_scripts', 'podcraft')()
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/astraluma/code/mc/podcraft/podcraft/cli.py", line 24, in build
    pc.rebuild_everything()
  File "/home/astraluma/code/mc/podcraft/podcraft/mainobj.py", line 128, in rebuild_everything
    serv_con = create_container(serv_img, pod, volumes)
  File "/home/astraluma/code/mc/podcraft/podcraft/containers.py", line 13, in create_container
    return image.create(
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.8/site-packages/podman/libs/images.py", line 44, in create
    config['image'] = copy.deepcopy(details.repotags[0])
TypeError: 'NoneType' object is not subscriptable

It looks like if I don't give an image a tag, Image.create() cannot use it to create a container.

Search function throws 'no attribute SearchImage' error

Encountered the below error while trying to search a particular image by id_ using search functionality search(self, id_, limit=25)

Traceback (most recent call last):
  File "sdk.py", line 9, in <module>
    for eln in img:
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 156, in search
    results = podman.SearchImage(id_, limit)
AttributeError: 'SimpleClientInterfaceHandler' object has no attribute 'SearchImage'

Trigger automated checks to keep python-podman aligned with libpod defined interfaces

Summarize

In the sake of compatibilty in libpod and python-podman I propose to design and implement automated checks to verify if python-podman implementation is fully compatible with libpod varlink defined interface.

The goal of this ticket is to discuss about this feature design and watch how we could implement this and the needs behind this (impact on project workflow, how to proceed etc...).

Draft design

Project lifecycle

I think we need to create a git branch dedicated for each libpod version that we want to maintain to avoid to introduce future features into wrong branches and python-podman releases, in other word we need to isolate development versions.

The master branch will only reflect the libpod master and will help us to synchronize changes between future latest versions only.

I think we need as many version of python-podman than existing libpod versions to keep the python-api compatible with libpod defined interface.

Triggering automated checks

The automated check can be trigger from:

The automated check need to reflect the relation between version on the both projects, we only need to compare the varlink defined interface in the right libpod tag version and on the right development branch version on python-podman.

If we choose to trigger automated checks on python-podman then we need to pull from the right libpod tag/branch the raw varlink defined interface file (by using http request) and then compare it the python-podman implementation.

How to compare interface with implementation

For the moment I see some solutions to compare if these projects are synchronized, lets describe them.

Maybe you will see other/better solutions to manage this.

Don't forget that the main goal of this issue is to discuss with you if we can do this and how to do this before starting to spend time on it. Also I want to raise pro and con that I may miss.

First solution

The main idea in this solution is to compare function signatures.

Steps needed in order:

  • download the raw interface description form libpod repo
  • parse the previous download file to extract defined signature
  • parse the function implementation available in python-podman
  • compare the both and observe if delta exists
  • raise error if delta exist
  • automatically open a new github python-podman issue with attached job output to inform us and then fix the issue

The main difficulty here is how to ignore perifical function which are part of the python-podman mechanisms and not related to interface implementation... Since python-podman is only compatible with python3 we could by example use the powerful python inspect module coupled with a standardized mechanism which will allow us to analyze keywords in functions's docstrings to detect if the function is part of the interface definition, determine which interface the implementation is linked and if signature need to be compared with interface definition.

All these things can be done in pure python without extra module and dependencies (or just to some mainstream requirements).

We don't need to compile and install libpod here, we just need to refer to the related interface.

I think this one is the more preferable solution and the more safer and the less painful.

Second solution

On travis's instance compile and install the right libpod version and then start its varlink server, and then run unit tests against but I think it's more likely that libpod's varlink defined interface will be ahead of the python-podman implementation. In this case it can be difficult to witness raised exceptions from the python-podman side because the python-podman would not pass undefined params (except if some params are removed from libpod and not yet removed from python-podman).

Maybe I'm wrong by thinking this way, I'm not sure if all params are mandatory and if exceptions can be raised by doing this. If exception are raised then it's can be a way to identify non synchonized interface implemention in python-podman.

My main concern about this solution is how to properly manage travis instance, libpod rights (sudo etc...), rootless needs, etc... on a travis's instance image which could have some limitations. I think it can be painful to follow this way and our goal is not to test libpod but just to observe if implementation is rightly synchronized, I don't want to fight with windmills here.

Third solution

By adding new capabilities to the varlink's mocking feature it will allow us to generate a fake service by lookup form the downloaded raw interface to generate some fake python classes (rather than generating fake interface definition from fake python class as is currently the case).

Then we can mix solution 1 and solution 2 approachs (if enough unit test exists for solution 2), and by example compare generated function's signatures and real implementation signatures.

Like has explained in the second solution I'm not sure if 100 percent of the args are mandatories and if some are missing I'm not sure we will catch exception and error. Anyway with this approach libpod stay ahead of the python-podman implementation so this is the main risk.

This is a cross project solution which ask to us to adding new feature on the varlink side and in a second time to implement the check on python-podman.

The main advantage here is to provide feature which can be reused outside of the scope podman (the feature added to varlink).

Conclusion

I think we need this kind of feature to avoid to spend time fix issue unsynchronized implementation.

Also I think these changes can help us to better handle the support of libpod's versions on python-podman and to more often and more merely release new versions of this API.

Do not hesitate to react to my proposal by sending comments here.

Possibly related to

Pull image function throws KeyError for id

Pull image function pull(self, source)for Python podman throws following error as the function tries to returns id from results

Traceback (most recent call last):
  File "sdk.py", line 6, in <module>
    print(client.images.pull('fedora:latest'))
  File "/root/.local/lib/python3.7/site-packages/podman-1.3.1-py3.7.egg/podman/libs/images.py", line 151, in pull
KeyError: 'id'

Is there an API documentation?

after looking at the code's docstrings, i understand that there is unsufficent embedded documentation to build an API documentation.

Maybe you want to keep this issue open for others that are wondering how they could employ this library until API docs are available.

pypodman kill: option "-a/--all" and "-l/--latest" are not implemented

Is this a BUG REPORT or FEATURE REQUEST?:

kind feature

Description
As the title said, these two options are not implemented, but podman can use them smoothly.
podman kill doc:

--all, -a
Signal all running containers. This does not include paused containers.
--latest, -l
Instead of providing the container name or ID, use the last created container. If you use methods other than Podman to run containers such as CRI-O, the last started container could be from either of those methods.

Although these two options are not provided as parameters in varlink method:

method KillContainer(name: string, signal: int) -> (container: string)

but we might implement this with the help of the other methods besides KillContainer().

python3-podman: can't utilize rootless podman

Is this a BUG REPORT or FEATURE REQUEST?:

[//]: # kind bug

Description

I really like the python interface you have built. Unfortunately it's not possible to be used with rootless podman due to the varlink limitation. Is there a way to solve it? (have two sockets maybe?)

srw-------. 1 root root 0 Nov  1 14:45 io.podman
srw-------. 1 root root 0 Nov  1 14:45 podman/io.podman
$ id
uid=1000(tt) gid=1000(tt)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

$ ipython3
Python 3.7.1 (default, Oct 23 2018, 18:19:07)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import podman

In [2]: with podman.Client() as client:
   ...:   list(map(print, client.images.list()))
   ...:
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
...

/usr/lib/python3.7/site-packages/varlink/client.py in open_unix()
    459                 s = socket.socket(socket.AF_UNIX)
    460                 s.setblocking(True)
--> 461                 s.connect(address)
    462                 return s
    463

PermissionError: [Errno 13] Permission denied

$ podman images
REPOSITORY                                   TAG                       IMAGE ID       CREATED             SIZE
localhost/this-is-my-image                   latest                    d49960b9dbcd   29 minutes ago      83.2MB
<none>                                       <none>                    d3b925049e8d   29 minutes ago      83.2MB
localhost/this-is-my-image-20181701-161756   latest                    2a566e4de41f   29 minutes ago      83.2MB
docker.io/library/python                     3-alpine                  408808fb1a9e   7 days ago          82MB
registry.fedoraproject.org/fedora            29                        a5cc8ccd230a   2 weeks ago         306MB

BuildImage function in varlink api throws ' unable to open context dir tar file /path/to/context.tar ' error

Description:

BuildImage function in varlink api is throwing error ' unable to open context dir tar file /path/to/context.tar '.

Steps to reproduce:

  1. Created a docker file
  2. Created a python file to call build function with two parameters - dockerfile, imagetag

Below is the test code:

import podman
import os

with podman.Client() as client:
 file="/dockerfile"
 path=os.getcwd()+file
 dockerfile=open(path,'+w');
 print(client.images.build(dockerfile,'latest'))

Encountered below error on line client.images.build(dockerfile,'latest')

Traceback (most recent call last):
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 131, in build
    result = podman.BuildImage(config)
  File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 86, in _wrapped
    return self._call(method.name, *args, **kwargs)
  File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 143, in _call
    (message, more) = self._next_varlink_message()
  File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 113, in _next_varlink_message
    raise e
varlink.error.VarlinkError: {'parameters': {'reason': 'unable to open context dir tar file '}, 'error': 'io.podman.ErrorOccurred'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sdk1.py", line 8, in <module>
    print(client.images.build(dockerfile,'latest'))
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 131, in build
    result = podman.BuildImage(config)
  File "/root/.local/lib/python3.7/site-packages/podman/client.py", line 109, in __exit__
    raise error_factory(e)
podman.libs.errors.ErrorOccurred: {'parameters': {'reason': 'unable to open context dir tar file '}, 'error': 'io.podman.ErrorOccurred'}

pypodman commit: when option "--author" is not set, the value should not be the username of the host

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
I missed this bug before. Today I found if --author is not set, the username of the host will be used.
This is different from podman commit, the author is supposed to be the original image's author which created and started the container:
https://github.com/jwhonce/libpod/blob/f8c5e75a10fb0a9a3a3c113075c129521c5c5099/contrib/python/podman/podman/libs/containers.py#L133

Steps to reproduce the issue:
On Remote:

[root@rhel8-1 ~]# podman ps -a
CONTAINER ID   IMAGE                             COMMAND     CREATED       STATUS                   PORTS   NAMES         IS INFRA
5460b2b46177   docker.io/library/fedora:latest   /bin/bash   3 hours ago   Exited (0) 3 hours ago           test-commit   false

On host:

  1. ~/.local/bin/pypodman -l root --host 192.168.122.213 commit test-commit image-committed

Describe the results you received:

[root@rhel8-1 ~]# podman inspect image-committed
[
    ......
    "Author": "root",
    ......

Describe the results you expected:
If I do the same thing with podman on remote:

[root@rhel8-1 ~]# podman commit test-commit image-committed1
Getting image source signatures
Skipping fetch of repeat blob sha256:a13f3c019d290327c0e1470e98bc0d40af51755de9a913f64bcc664ecbaf6349
Skipping fetch of repeat blob sha256:bb242c3eba4f90127ceddf527aa600d211f39a26202cf07bf3a9de9c0981beab
Copying config sha256:a6f6ee75b97392a4a9f9fc71eaffb08274b16837a20d62d98d04358ef6501ce0
 1.62 KB / 1.62 KB [========================================================] 0s
Writing manifest to image destination
Storing signatures
a6f6ee75b97392a4a9f9fc71eaffb08274b16837a20d62d98d04358ef6501ce0
[root@rhel8-1 ~]# podman inspect image-committed1
[
    {
    ......
    "Author": "[Adam Miller <[email protected]>] [Patrick Uiterwijk <[email protected]>]",
    ......
   }
]
[root@rhel8-1 ~]# podman inspect fedora
[
    {
     ......
     "Author": "[Adam Miller <[email protected]>] [Patrick Uiterwijk <[email protected]>]",
     ......
    }
]

pypodman for WINDOWS: No module named 'fcntl'

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
I'm trying to use pypodman on windows. It's said module 'fcntl' is not found. As I know, this module is not available on windows, we should use some other package to replace it.
https://github.com/containers/libpod/blob/7f91ebb441846bc5a9c44861c70bec66b9015fa3/contrib/python/podman/podman/libs/_containers_attach.py#L4

Steps to reproduce the issue:
On my windows10 VM:

  1. install varlink

  2. install podman package following:

cd ~/libpod/contrib/python/podman
python3 setup.py clean -a && python3 setup.py sdist bdist
python3 setup.py install --user
  1. python3 -c "import podman"

Describe the results you received:

C:\Users\edward\work>python -c "import podman"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\edward\AppData\Roaming\Python\Python36\site-packages\podman-0.0.0-py3.6.egg\podman\__init__.py", line 4, in <module>
  File "C:\Users\edward\AppData\Roaming\Python\Python36\site-packages\podman-0.0.0-py3.6.egg\podman\client.py", line 11, in <module>
  File "C:\Users\edward\AppData\Roaming\Python\Python36\site-packages\podman-0.0.0-py3.6.egg\podman\libs\containers.py", line 10, in <module>
  File "C:\Users\edward\AppData\Roaming\Python\Python36\site-packages\podman-0.0.0-py3.6.egg\podman\libs\_containers_attach.py", line 4, in <module>
ModuleNotFoundError: No module named 'fcntl'

Describe the results you expected:
podman package can be used on windows smoothly.

Document minimum system requirements

Think you need to list minimum versions required, of the various system tools used:

  • Python 3.5+ (?)

  • OpenSSH 6.7+

Had some issues, when I tried to use older versions:

    **options,
             ^
SyntaxError: invalid syntax

https://docs.python.org/3/whatsnew/3.5.html#whatsnew-pep-448

PEP 448 extends the allowed uses of the * iterable unpacking operator and ** dictionary unpacking operator. It is now possible to use an arbitrary number of unpackings in function calls:

Bad local forwarding specification '/tmp/pypodman/podman.socket:/run/podman/io.podman'

https://www.openssh.com/txt/release-6.7

  • ssh(1), sshd(8): Add support for Unix domain socket forwarding.
    A remote TCP port may be forwarded to a local Unix domain socket
    and vice versa or both ends may be a Unix domain socket.

Shouldn't be unreasonable to demand (?), but would be good to document anyway...

pypodman search: a ValueError is raised when nothing can be searched out

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
As the title said.

Steps to reproduce the issue:

  1. pypodman -l root --host 192.168.122.213 search xxxxyyyy

Describe the results you received:

[root@localhost libpod]# pypodman -l root --host 192.168.122.213 search xxxxyyyy
Traceback (most recent call last):
  File "/root/.local/bin/pypodman", line 11, in <module>
    load_entry_point('pypodman==0.0.0', 'console_scripts', 'pypodman')()
  File "/root/.local/lib/python3.6/site-packages/pypodman-0.0.0-py3.6.egg/pypodman/main.py", line 58, in main
  File "/root/.local/lib/python3.6/site-packages/pypodman-0.0.0-py3.6.egg/pypodman/lib/actions/search_action.py", line 152, in search
  File "/root/.local/lib/python3.6/site-p
ackages/pypodman-0.0.0-py3.6.egg/pypodman/lib/report.py", line 78, in layout
ValueError: max() arg is an empty sequence

Describe the results you expected:
No error is printed out.

pypodman commit: option "--message" still does not work

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
After #1881, option --message still doesn't work. Probably because the option --format is not implemented and --message can be set only when --format has value docker, which can refer to https://github.com/containers/libpod/blob/master/docs/podman-commit.1.md:

--message, -m
Set commit message for committed image. The message field is not supported in oci format.

The argument --format/-f is not gotten from argparser, and --message should only be able to set when --format is docker:
https://github.com/jwhonce/libpod/blob/f8c5e75a10fb0a9a3a3c113075c129521c5c5099/contrib/python/podman/podman/libs/containers.py#L133-L137
https://github.com/jwhonce/libpod/blob/f8c5e75a10fb0a9a3a3c113075c129521c5c5099/contrib/python/podman/podman/libs/containers.py#L145-L146

Steps to reproduce the issue:
On Remote:

[root@rhel8-1 ~]# podman ps -a
CONTAINER ID   IMAGE                             COMMAND     CREATED       STATUS                   PORTS   NAMES         IS INFRA
5460b2b46177   docker.io/library/fedora:latest   /bin/bash   2 hours ago   Exited (0) 2 hours ago           test-commit   false

On Host:

  1. ~/.local/bin/pypodman -l root --host 192.168.122.213 commit --message "test commit msg" test-commit image-commited
  2. ~/.local/bin/pypodman -l root --host 192.168.122.213 commit --message "test commit msg" --format docker test-commit image-commited1

Describe the results you received:

  1. The image image-commited is created, but it has no comment message:
[root@rhel8-1 ~]# podman inspect image-commited
[
    {
        ......
        "Comment": "",
        ......
   }
]
  1. The image image-commited1 is created, but it still has the type oci(by default) and doesn't have the comment message too:
[root@rhel8-1 ~]# podman inspect image-commited1
[
    {
       ......
        "Comment": "", 
       ......
       "ManifestType": "application/vnd.oci.image.manifest.v1+json",
       ......
    }
]

Describe the results you expected:

  1. the command should fail.
    If I do this on remote with podman:
[root@rhel8-1 ~]# podman commit --message "test commit msg" test-commit image-commited
messages are only compatible with the docker image format (-f docker)
  1. If I do the same thing on remote with podman commit --message "test commit msg" --format docker test-commit image-commited2:
[root@rhel8-1 ~]# podman inspect image-commited2
[
    {
        ......
        "Comment": "test commit msg",
        ......
       "ManifestType": "application/vnd.docker.distribution.manifest.v2+json",
        ......
    }
]

Push Image function throws KeyError: 'image'

Description: Push image function push(self, target, tlsverify=True) return results['images'] which throws the below error

Traceback (most recent call last):
  File "sdk_push.py", line 11, in <module>
    result= img.push("docker://docker.io/dhanisha/fedora")
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 82, in push
    return results['image']
KeyError: 'image'

Use below code to reproduce the error:

img = client.images.get('fedora')
res= img.push("docker://docker.io/dhanisha/fedora")
print(res)

Observation :
results value does not contain image key and also does not display id

{'reply': {'logs': ['Getting image source signatures\n', 'Copying blob sha256:4843c53b9094f182c4b6ac3412c333d8b770869e2ee2f81ba684ea507f247063\n', 'Copying config sha256:ef49352c9c21ca58ce753fd0b5dda645492236cec4213ac31ee47c35f2e91b1c\n', 'Writing manifest to image destination\n', 'Storing signatures\n'], 'id': ''}}

Fully specify dependencies

I realise a lot is in flux here with and after #25, but just mentioning that I tried to install from git, and the installation process does not trigger any dependencies to be pulled in (I'm sure that once published to PyPI this would work already a bit better), and the metadata seems to be missing some packages.

First error I got was missing package varlink, and while installing that, I got:

>pip install varlink
Collecting varlink
  Downloading https://files.pythonhosted.org/packages/80/4f/8ac1e3fd7f766b68a5273926faf810d7a2d81863ce0a57c74b47461dd353/varlink-30.1.2-py2.py3-none-any.whl
ERROR: podman 0.0.1 requires psutil, which is not installed.
ERROR: podman 0.0.1 requires python-dateutil, which is not installed

So it seems psutil / python-dateutil are specified, but not varlink, and neither the missing package error I got after installing all that.

>>> import podman
Traceback (most recent call last):
[...]
ModuleNotFoundError: No module named 'fcntl'
[...]
>pip install fcntl
Collecting fcntl
  ERROR: Could not find a version that satisfies the requirement fcntl (from versions: none)
ERROR: No matching distribution found for fcntl

Not sure what else might be missing, since I cannot install fcntl from either pip or conda.

pypodman: 'attach' doesn't

I think pypodman/lib/actions/attach_action.py got created as a skeleton but never actually implemented. I'm sorry, rewriting it is currently more than I can dive into right now.

'org.varlink.service.InvalidParameter' error while using Push function

Description: Push image function throws below error

Traceback (most recent call last):
  File "push.py", line 9, in <module>
    result= img.push("docker://docker.io/dhanisha/fedora")
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 88, in push
    sign_by)
  File "/root/.local/lib/python3.7/site-packages/podman/client.py", line 109, in __exit__
    raise error_factory(e)
  File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 88, in push
    sign_by)
  File "/root/.local/lib/python3.7/site-packages/varlink/client.py", line 86, in _wrapped
    return self._call(method.name, *args, **kwargs)
  File "/root/.local/lib/python3.7/site-packages/varlink/client.py", line 127, in _call
    parameters = self._interface.filter_params("client.call", method.in_type, False, args, kwargs)
  File "/root/.local/lib/python3.7/site-packages/varlink/scanner.py", line 382, in filter_params
    None)
  File "/root/.local/lib/python3.7/site-packages/varlink/scanner.py", line 359, in filter_params
    raise InvalidParameter(parent_name)
varlink.error.InvalidParameter: {'error': 'org.varlink.service.InvalidParameter', 'parameters': {'parameter': 'client.call.creds'}}

Use below code to reproduce the error:

img = client.images.get('fedora')
res= img.push("docker://docker.io/dhanisha/fedora")
print(res)

Can anyone please tell me whether my usage of the functionality is wrong.

Call host podman inside a container but encounter `Connection refused` error

I want to call host podman inside a container by podman python client

So I do

  1. run a contianer and mount podman socket
    podman run -it --privileged --entrypoint=bash -v /lib/systemd/system/io.podman.socket:/lib/systemd/system/io.podman.socket docker.io/python:3.6

  2. then I login to the container, install python package
    python3 -m pip install podman

  3. call podman with the socket unix:/lib/systemd/system/io.podman.socket like what I did with docker but error shows

python
Python 3.6.9 (default, Sep 12 2019, 16:23:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> pclient=podman.Client(uri='unix:/lib/systemd/system/io.podman.socket')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/podman/client.py", line 178, in __init__
    if not System(self._client).ping():
  File "/usr/local/lib/python3.6/site-packages/podman/libs/system.py", line 38, in ping
    with self._client() as podman:
  File "/usr/local/lib/python3.6/site-packages/podman/client.py", line 98, in __enter__
    self._iface = self._client.open(self._context.interface)
  File "/usr/local/lib/python3.6/site-packages/varlink/client.py", line 598, in open
    connection = self.open_connection()
  File "/usr/local/lib/python3.6/site-packages/varlink/client.py", line 613, in open_connection
    return self._socket_fn()
  File "/usr/local/lib/python3.6/site-packages/varlink/client.py", line 512, in open_unix
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

pypodman logs: option `--since`, `-f` and `-t/--timestamps` are not implemented

Is this a BUG REPORT or FEATURE REQUEST?:

kind feature

Description
As the title, below options are not implemented:

--follow, -f
Follow log output. Default is false
--since=TIMESTAMP
Show logs since TIMESTAMP. The --since option can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed relative to the client machine's time. Supported formats for date formatted time stamps include RFC3339Nano, RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, and 2006-01-02.
--timestamps, -t
Show timestamps in the log outputs. The default is false

The implementation of --follow might be difficult/impossible, but --since and --timestamps are possible.

Multiple Volumes not reported

When inspecting an Image, only one volume is reported.

From podman inspect:

            "Volumes": {
                "/mc/banned-ips.json": {},
                "/mc/banned-players.json": {},
                "/mc/logs": {},
                "/mc/ops.json": {},
                "/mc/server.properties": {},
                "/mc/whitelist.json": {},
                "/mc/world": {}
            }

From Image.inspect():

 'volumes': {'/mc/world': {}}

pypodman restart: option '--all' and '--running' do NOT work

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description
As the title said, these two options --all and --running do not work for pypodman.

Steps to reproduce the issue:
On remote:

[root@rhel8-1 ~]# podman ps -a
CONTAINER ID   IMAGE                             COMMAND     CREATED          STATUS             PORTS   NAMES           IS INFRA
81f37fedee38   docker.io/library/fedora:latest   /bin/bash   47 seconds ago   Up 2 seconds ago           test-restart1   false
ae1c3af50e4d   docker.io/library/fedora:latest   /bin/bash   58 seconds ago   Up 3 seconds ago           test-restart    false

On host:

  1. pypodman -l root --host 192.168.122.213 restart --running

  2. pypodman -l root --host 192.168.122.213 restart --all

Describe the results you received:
On host:
1.

[root@localhost libpod]# pypodman -l root --host 192.168.122.213 restart --running
2018-12-24 15:08:36 CST | ERROR    | pypodman restart: the following arguments are required: targets
2018-12-24 15:08:36 CST | ERROR    | Try 'pypodman restart --help' for more information.
[root@localhost libpod]# pypodman -l root --host 192.168.122.213 restart --all
2018-12-24 15:09:11 CST | ERROR    | pypodman restart: the following arguments are required: targets
2018-12-24 15:09:11 CST | ERROR    | Try 'pypodman restart --help' for more information.

Describe the results you expected:
These options can work as podman does:
https://github.com/containers/libpod/blob/master/docs/podman-restart.1.md

Libary calls do not work

I installed podman and the python podman library. But I does not show any images or containers:

$ podman version
Version:      2.0.4
API Version:  1
Go Version:   go1.14.4
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

$ podman images
REPOSITORY                TAG     IMAGE ID      CREATED       SIZE
docker.io/library/nginx   latest  4bb46517cac3  7 days ago    137 MB
docker.io/library/alpine  latest  a24bb4013296  2 months ago  5.85 MB

$ podman ps
CONTAINER ID  IMAGE                           COMMAND               CREATED            STATUS                PORTS   NAMES
96f979df67f8  docker.io/library/nginx:latest  nginx -g daemon o...  About an hour ago  Up About an hour ago          eager_galileo

My Python Script:

#!/usr/bin/env python3

import podman

with podman.Client() as client:
    print(client.images.list())
    for image in client.images.list():
        print(image)
    print(client.containers.list())
    for container in client.containers.list():
        print(container)

Output:

<generator object Images.list at 0x7f41cbd344c0>
<generator object Containers.list at 0x7f41cbd344c0>

Am I doing anything wrong? I installed it first following this blog post. Does this break anything due to the new API. Also is there a documentation anywhere?

"endpoint requires a more connection"

When attempting to build an image, I get this extremely nonsensical error:

>>> podcraft.poddir.build_server(pm, "/home/astraluma/.mc/qwi", {})
Traceback (most recent call last):
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/podman/libs/images.py", line 138, in build
    result = podman.BuildImage(config)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/varlink/client.py", line 89, in _wrapped
    return self._call(method.name, *args, **kwargs)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/varlink/client.py", line 146, in _call
    (message, more) = self._next_varlink_message()
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/varlink/client.py", line 116, in _next_varlink_message
    raise e
varlink.error.VarlinkError: {'parameters': {'reason': 'endpoint requires a more connection'}, 'error': 'io.podman.ErrorOccurred'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/astraluma/code/mc/podcraft/podcraft/poddir.py", line 57, in build_server
    'podcraft.root': serverdir,
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/podman/libs/images.py", line 138, in build
    result = podman.BuildImage(config)
  File "/home/astraluma/.virtualenvs/mc/podcraft/lib/python3.7/site-packages/podman/client.py", line 109, in __exit__
    raise error_factory(e)
podman.libs.errors.ErrorOccurred: {'parameters': {'reason': 'endpoint requires a more connection'}, 'error': 'io.podman.ErrorOccurred'}

The invocation is

client.images.build(
    buildArgs=buildargs,  # Dictionary, empty
    contextDir=buildroot,  # String, full path to a .tar
    dockerfile=dockerfile,  # String, full path to Dockerfile
    tags="TODO",
    annotations={
        'podcraft.root': serverdir,  # String, a full path (doesn't exit)
    },
)

Best as I can read the go code (don't know go) and can google, this sounds like the particulars of how python-podman is constructing the varlink invocation?

Images.build incorrectly uses os.walk

The method podman/libs/images.py#Images.build runs os.walk, and expects it to return a list of files from context_directory. It actually yields a 3-tuple (dirpath, dirnames, filenames) as described here. Later, when trying to add files into the tar archive (line 176), the program fails with error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edd/.local/lib/python3.8/site-packages/podman/libs/images.py", line 189, in build
    tar.addfile(tar.gettarinfo(fileobj=open(name)))
TypeError: expected str, bytes or os.PathLike object, not tuple

While we're at it, how is this code expected to function when encountering an empty directory?

[Help] Can't start created container: executable file not found in $PATH

I am trying to start a container using the python API from this repo:

# up log level
import logging
logging.getLogger().setLevel(logging.DEBUG)
# action
import podman
with podman.Client() as client:
    image_id = client.images.pull("jupyterhub/singleuser:latest")
    image = client.images.get(image_id)
    container = image.create()
    container.start()

this throws an error, claims that the entrypoint command tini can't be found in the container:

DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb18f0cf8>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb18f0cf8>
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12fab00>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12fab00>
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb1254e80>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb1254e80>
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12ee5f8>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12ee5f8>
DEBUG:root:Image f98c2844eec476cbb932cb58def069bcd5cff8f674978881fc055bcf0693ec19: create config: {'image_id': 'f98c2844eec476cbb932cb58def069bcd5cff8f674978881fc055bcf0693ec19', 'command': ['start-notebook.sh'], 'env': {'PATH': '/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'DEBIAN_FRONTEND': 'noninteractive', 'CONDA_DIR': '/opt/conda', 'SHELL': '/bin/bash', 'NB_USER': 'jovyan', 'NB_UID': '1000', 'NB_GID': '100', 'LC_ALL': 'en_US.UTF-8', 'LANG': 'en_US.UTF-8', 'LANGUAGE': 'en_US.UTF-8', 'HOME': '/home/jovyan', 'MINICONDA_VERSION': '4.8.3', 'MINICONDA_MD5': 'd63adf39f2c220950a063e0529d4ff74', 'CONDA_VERSION': '4.8.3'}, 'image': 'docker.io/jupyterhub/singleuser:latest', 'labels': {'maintainer': 'Jupyter Project <[email protected]>'}, 'net_mode': 'bridge', 'network': 'bridge', 'args': ['docker.io/jupyterhub/singleuser:latest', 'start-notebook.sh']}
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12d4e80>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb12d4e80>
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb11a3ac8>
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb11a3ac8>
DEBUG:root:LocalClient opened varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb11b0128>
DEBUG:root:Starting Container "76f9f218441753ffcdc12dfb35a361f91cbc89a3d58379014ce8e0b4460fc2e2"
DEBUG:root:LocalClient closed varlink connection <varlink.client.SimpleClientInterfaceHandler object at 0x7feeb11b0128>
Traceback (most recent call last):
  File "/root/checkpointspawner/python-podman/podman/libs/_containers_start.py", line 24, in start
    results = podman.StartContainer(self._id)
  File "/root/checkpointspawner/env/lib64/python3.6/site-packages/varlink/client.py", line 89, in _wrapped
    return self._call(method.name, *args, **kwargs)
  File "/root/checkpointspawner/env/lib64/python3.6/site-packages/varlink/client.py", line 146, in _call
    (message, more) = self._next_varlink_message()
  File "/root/checkpointspawner/env/lib64/python3.6/site-packages/varlink/client.py", line 116, in _next_varlink_message
    raise e
varlink.error.VarlinkError: {'parameters': {'reason': 'container_linux.go:349: starting container process caused "exec: \\"tini\\": executable file not found in $PATH": OCI runtime command not found error'}, 'error': 'io.podman.ErrorOccurred'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/root/checkpointspawner/python-podman/podman/libs/_containers_start.py", line 82, in start
    return self._refresh(podman)
  File "/root/checkpointspawner/python-podman/podman/client.py", line 139, in __exit__
    raise error_factory(e)
podman.libs.errors.ErrorOccurred: {'parameters': {'reason': 'container_linux.go:349: starting container process caused "exec: \\"tini\\": executable file not found in $PATH": OCI runtime command not found error'}, 'error': 'io.podman.ErrorOccurred'}

I can get the container to start just fine if I use the CLI:

podman run jupyterhub/singleuser:latest

is succesful.

I tried using a different image, and it works fine:

# up log level
import logging
logging.getLogger().setLevel(logging.DEBUG)
# action
import podman
with podman.Client() as client:
    image_id = client.images.pull("alpine:latest")
    image = client.images.get(image_id)
    container = image.create()
    container.start()

I then tried doing a mix: creating the container with the CLI:

podman container create jupyterhub/singleuser:latest

which returns a container id <container-id>, and then using the Python API to start it:

# up log level
import logging
logging.getLogger().setLevel(logging.DEBUG)
# action
import podman
with podman.Client() as client:
    container = client.containers.get(<container-id>)
    container.start()

which is successful

Additionally, I can go the other way: create the container with the Python API

# up log level
import logging
logging.getLogger().setLevel(logging.DEBUG)
# action
import podman
with podman.Client() as client:
    image_id = client.images.pull("jupyterhub/singleuser:latest")
    image = client.images.get(image_id)
    container = image.create()
    print(container.id)

which outputs <container-id>, and I can use the CLI to start it:

podman container start <container-id>

which gives an error:

Error: unable to start container "a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604": container_linux.go:349: starting container process caused "exec: \"tini\": executable file not found in $PATH": OCI runtime command not found error

This tells me that there's something going wrong with how this particular image is being created as a container using the Python API.

Here's the inspect information for the image:

Image Inspect
$ podman image inspect jupyterhub/singleuser:latest
[
    {
        "Id": "f98c2844eec476cbb932cb58def069bcd5cff8f674978881fc055bcf0693ec19",
        "Digest": "sha256:e65267c652a3dea035c25bdc93d179788a61c233a662f9a5366b4142e46a7b5d",
        "RepoTags": [
            "docker.io/jupyterhub/singleuser:latest"
        ],
        "RepoDigests": [
            "docker.io/jupyterhub/singleuser@sha256:e65267c652a3dea035c25bdc93d179788a61c233a662f9a5366b4142e46a7b5d"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2020-07-31T10:22:38.17249833Z",
        "Config": {
            "User": "1000",
            "ExposedPorts": {
                "8888/tcp": {}
            },
            "Env": [
                "PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "DEBIAN_FRONTEND=noninteractive",
                "CONDA_DIR=/opt/conda",
                "SHELL=/bin/bash",
                "NB_USER=jovyan",
                "NB_UID=1000",
                "NB_GID=100",
                "LC_ALL=en_US.UTF-8",
                "LANG=en_US.UTF-8",
                "LANGUAGE=en_US.UTF-8",
                "HOME=/home/jovyan",
                "MINICONDA_VERSION=4.8.3",
                "MINICONDA_MD5=d63adf39f2c220950a063e0529d4ff74",
                "CONDA_VERSION=4.8.3"
            ],
            "Entrypoint": [
                "tini",
                "-g",
                "--"
            ],
            "Cmd": [
                "start-notebook.sh"
            ],
            "WorkingDir": "/home/jovyan",
            "Labels": {
                "maintainer": "Jupyter Project <[email protected]>"
            }
        },
        "Version": "19.03.8",
        "Author": "Project Jupyter <[email protected]>",
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 746017989,
        "VirtualSize": 746017989,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/containers/storage/overlay/6e97361a4c0f6238f3f847bbbd84e476f3d12db6a75d524cdaa9c9d3b7641b1c/diff:/var/lib/containers/storage/overlay/1a759e27e0fc9122830680f71fe9c6dc71570dadd84e65bc08a2643eff87eadf/diff:/var/lib/containers/storage/overlay/333ffdfeeda6f14ab81ec3159f26c42f5c8514bc943b684c90ed98adef0d3dca/diff:/var/lib/containers/storage/overlay/f8c412df741909af0a20553b43c0a3895cee40317fc812f44572c9f04eaa66f2/diff:/var/lib/containers/storage/overlay/618a3af6a816f4d7fe48810ce798dd43e1277c39d85c8fa3144f20e6ccaa6193/diff:/var/lib/containers/storage/overlay/e74ffc54c99cd259134e36b203c6ab005df0bfd03efb68b5e1404071b6f1fc7d/diff:/var/lib/containers/storage/overlay/1ea64673d3aed0ab4c524a06f66b12275ea9e811d83763cedcf87a643d10b2a9/diff:/var/lib/containers/storage/overlay/47d3ba77a6da5e64f5dd3f3103729c41d4ea28dd3acf4eda6aa3deabc0a6ba3e/diff:/var/lib/containers/storage/overlay/0f13289ee6047a0af2c2da72fde4b07dde2760c6bd5ffbfdff50d18964a9f3e4/diff:/var/lib/containers/storage/overlay/103b666a8482eebcd34b088eea2b8955bfdca9280b4b802c15b1a06bf72bfc9e/diff:/var/lib/containers/storage/overlay/a365215521412762b731791a4e98169577428f319cadbbaca54c6b2d857cb37f/diff:/var/lib/containers/storage/overlay/626699adc61f1d9a01899423de78c7b875d9f4fa8c156d78cca37a1e8586458e/diff:/var/lib/containers/storage/overlay/7ee3433ebdb9fcfd9e1921e98ce740895e4f7fe0d23a4ce0e7a8ad2cc898f07f/diff:/var/lib/containers/storage/overlay/c5914a774f598d300553acb5dc31da85e04f813cfab7744db900e94c289d1af2/diff:/var/lib/containers/storage/overlay/60a71c5e6c29304f84beb1a85400368c5646b0b0e01c5a10ff50f7693fe60ffa/diff:/var/lib/containers/storage/overlay/3f9c2b6d8dddbad5d70cc4ccdcb4f6f68c1b65f6718dd3efac794a5035d64183/diff:/var/lib/containers/storage/overlay/df1094fb82405e981824e9705aca12f396d8175c0bd0fd6bb97c7a4f49d1ec88/diff:/var/lib/containers/storage/overlay/d22cfd6a8b16689838c570b91794ed18acc752a08a10bce891cc64acc1533b3f/diff",
                "UpperDir": "/var/lib/containers/storage/overlay/1b89d8d85ea7f40093b690a78a0fa19d028418f41c0bfb3660fdba9ccfe5e3cc/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/1b89d8d85ea7f40093b690a78a0fa19d028418f41c0bfb3660fdba9ccfe5e3cc/work"
            }
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:d22cfd6a8b16689838c570b91794ed18acc752a08a10bce891cc64acc1533b3f",
                "sha256:132bcd1e0eb5c706a017ff058b68d76c24f66f84120c51c7662de074a98cbe7a",
                "sha256:cf0f3facc4a307e4c36e346ddb777a73e576393575043e89d2ea536b693c3ff5",
                "sha256:544a70a875fc8e410b8a1389bf912e9536cf8167cbbfc1457bba355d5b7ce5c4",
                "sha256:8fb12b306bc4334420f40bbf7a23f8f8943c422b298efc1dd6d625b06ec95c79",
                "sha256:4b7eb71f03afc75314a8b0a1d42c9c5ecd11d13e94d2f23f6548e648bafc8db8",
                "sha256:9118f05dbee5f16387a4e4e50c1f2d933ca5a3df40cddd1dec13a6f305973424",
                "sha256:9118f05dbee5f16387a4e4e50c1f2d933ca5a3df40cddd1dec13a6f305973424",
                "sha256:d965477b97342363defb1ea9e6687eeec40a6246982e33a5e3ad0544e06c95a4",
                "sha256:8ac0d05486fce4c52cb01f4600c9ab4b1b26eaf5e3f501a3f4da5cfb667c65b7",
                "sha256:f1f19504f0306ef4ec824d55a1d51a3cdf0bd2ef31b40e06d51f6e373ab287ce",
                "sha256:a5475e9026e715df60775ce0d5276af2cd54d064e66ffe7a5d7463ea70e57c2a",
                "sha256:b34431a5f2eb510f0816c1e4f174de999490f083cceafd71b52abf2afacff173",
                "sha256:b203203c8e43c581de93f1224e58c97d29a28f08dd31f9021e2cd16a35d33eb5",
                "sha256:d9973ced7076322f5e8d7ff998437a8e4cf1a2cedac3274dfdd2f6c7f03b24a6",
                "sha256:20d805e832088af1abeef2b1d8b463b63e502a9f5d22a965a84673724510d061",
                "sha256:5fb2706450373119170e370c0f6353ceb183bcef23ef95ae1a6d622b1f28d9e3",
                "sha256:2a3f96a718d3afff91a10160e3b75a9d4d932d199eb564ec2b3f2b30ccecc622",
                "sha256:4d77ac3106b82281a696fc6873fa57f38ec78e7f41794f7830be2aef7197554b"
            ]
        },
        "Labels": {
            "maintainer": "Jupyter Project <[email protected]>"
        },
        "Annotations": {},
        "ManifestType": "application/vnd.docker.distribution.manifest.v2+json",
        "User": "1000",
        "History": [
            {
                "created": "2020-07-06T21:56:28.828661061Z",
                "created_by": "/bin/sh -c #(nop) ADD file:cf87af1f0e27aa6ffad26c57edca4ca55dc97861590a2d63475085a08d3b0063 in / "
            },
            {
                "created": "2020-07-06T21:56:29.704325263Z",
                "created_by": "/bin/sh -c [ -z \"$(apt-get indextargets)\" ]"
            },
            {
                "created": "2020-07-06T21:56:30.474974715Z",
                "created_by": "/bin/sh -c set -xe \t\t&& echo '#!/bin/sh' > /usr/sbin/policy-rc.d \t&& echo 'exit 101' >> /usr/sbin/policy-rc.d \t&& chmod +x /usr/sbin/policy-rc.d \t\t&& dpkg-divert --local --rename --add /sbin/initctl \t&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \t&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \t\t&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \t\t&& echo 'DPkg::Post-Invoke { \"rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true\"; };' > /etc/apt/apt.conf.d/docker-clean \t&& echo 'APT::Update::Post-Invoke { \"rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true\"; };' >> /etc/apt/apt.conf.d/docker-clean \t&& echo 'Dir::Cache::pkgcache \"\"; Dir::Cache::srcpkgcache \"\";' >> /etc/apt/apt.conf.d/docker-clean \t\t&& echo 'Acquire::Languages \"none\";' > /etc/apt/apt.conf.d/docker-no-languages \t\t&& echo 'Acquire::GzipIndexes \"true\"; Acquire::CompressionTypes::Order:: \"gz\";' > /etc/apt/apt.conf.d/docker-gzip-indexes \t\t&& echo 'Apt::AutoRemove::SuggestsImportant \"false\";' > /etc/apt/apt.conf.d/docker-autoremove-suggests"
            },
            {
                "created": "2020-07-06T21:56:31.295257919Z",
                "created_by": "/bin/sh -c mkdir -p /run/systemd && echo 'docker' > /run/systemd/container"
            },
            {
                "created": "2020-07-06T21:56:31.471255509Z",
                "created_by": "/bin/sh -c #(nop)  CMD [\"/bin/bash\"]",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:11.610631152Z",
                "created_by": "/bin/sh -c #(nop)  LABEL maintainer=Jupyter Project <[email protected]>",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:11.846446984Z",
                "created_by": "/bin/sh -c #(nop)  ARG NB_USER=jovyan",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:12.102668011Z",
                "created_by": "/bin/sh -c #(nop)  ARG NB_UID=1000",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:12.326598156Z",
                "created_by": "/bin/sh -c #(nop)  ARG NB_GID=100",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:12.563106469Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  SHELL [/bin/bash -o pipefail -c]",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:12.810461402Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  USER root",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:13.034413063Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ENV DEBIAN_FRONTEND=noninteractive",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:26.526685715Z",
                "created_by": "|3 NB_GID=100 NB_UID=1000 NB_USER=jovyan /bin/bash -o pipefail -c apt-get update  && apt-get install -yq --no-install-recommends     wget     bzip2     ca-certificates     sudo     locales     fonts-liberation     run-one  && apt-get clean && rm -rf /var/lib/apt/lists/*"
            },
            {
                "created": "2020-07-20T16:28:29.948217104Z",
                "created_by": "|3 NB_GID=100 NB_UID=1000 NB_USER=jovyan /bin/bash -o pipefail -c echo \"en_US.UTF-8 UTF-8\" > /etc/locale.gen &&     locale-gen"
            },
            {
                "created": "2020-07-20T16:28:30.197849107Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ENV CONDA_DIR=/opt/conda SHELL=/bin/bash NB_USER=jovyan NB_UID=1000 NB_GID=100 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:30.446482159Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ENV PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/home/jovyan",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:30.728771164Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) COPY file:2407375a36b13fb421cfc19e79bb173b917242379d7aa88e759005477f3a0de2 in /usr/local/bin/fix-permissions "
            },
            {
                "created": "2020-07-20T16:28:32.022499595Z",
                "created_by": "/bin/bash -o pipefail -c chmod a+rx /usr/local/bin/fix-permissions"
            },
            {
                "created": "2020-07-20T16:28:33.308586154Z",
                "created_by": "/bin/bash -o pipefail -c sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc"
            },
            {
                "created": "2020-07-20T16:28:34.716756804Z",
                "created_by": "/bin/bash -o pipefail -c echo \"auth requisite pam_deny.so\" >> /etc/pam.d/su &&     sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers &&     sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers &&     useradd -m -s /bin/bash -N -u $NB_UID $NB_USER &&     mkdir -p $CONDA_DIR &&     chown $NB_USER:$NB_GID $CONDA_DIR &&     chmod g+w /etc/passwd &&     fix-permissions $HOME &&     fix-permissions $CONDA_DIR"
            },
            {
                "created": "2020-07-20T16:28:34.970201486Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  USER 1000",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:35.201676676Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) WORKDIR /home/jovyan",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:35.42958766Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ARG PYTHON_VERSION=default",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:36.758811113Z",
                "created_by": "|1 PYTHON_VERSION=default /bin/bash -o pipefail -c mkdir /home/$NB_USER/work &&     fix-permissions /home/$NB_USER"
            },
            {
                "created": "2020-07-20T16:28:36.988290579Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ENV MINICONDA_VERSION=4.8.3 MINICONDA_MD5=d63adf39f2c220950a063e0529d4ff74 CONDA_VERSION=4.8.3",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:28:37.25061708Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) WORKDIR /tmp",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:31:21.925151438Z",
                "created_by": "|1 PYTHON_VERSION=default /bin/bash -o pipefail -c wget --quiet https://repo.continuum.io/miniconda/Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh &&     echo \"${MINICONDA_MD5} *Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh\" | md5sum -c - &&     /bin/bash Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR &&     rm Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh &&     echo \"conda ${CONDA_VERSION}\" >> $CONDA_DIR/conda-meta/pinned &&     conda config --system --prepend channels conda-forge &&     conda config --system --set auto_update_conda false &&     conda config --system --set show_channel_urls true &&     conda config --system --set channel_priority strict &&     if [ ! $PYTHON_VERSION = 'default' ]; then conda install --yes python=$PYTHON_VERSION; fi &&     conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned &&     conda install --quiet --yes conda &&     conda install --quiet --yes pip &&     conda update --all --quiet --yes &&     conda clean --all -f -y &&     rm -rf /home/$NB_USER/.cache/yarn &&     fix-permissions $CONDA_DIR &&     fix-permissions /home/$NB_USER"
            },
            {
                "created": "2020-07-20T16:31:38.095195868Z",
                "created_by": "|1 PYTHON_VERSION=default /bin/bash -o pipefail -c conda install --quiet --yes 'tini=0.18.0' &&     conda list tini | grep tini | tr -s ' ' | cut -d ' ' -f 1,2 >> $CONDA_DIR/conda-meta/pinned &&     conda clean --all -f -y &&     fix-permissions $CONDA_DIR &&     fix-permissions /home/$NB_USER"
            },
            {
                "created": "2020-07-20T16:34:03.340217468Z",
                "created_by": "|1 PYTHON_VERSION=default /bin/bash -o pipefail -c conda install --quiet --yes     'notebook=6.0.3'     'jupyterhub=1.1.0'     'jupyterlab=2.1.5' &&     conda clean --all -f -y &&     npm cache clean --force &&     jupyter notebook --generate-config &&     rm -rf $CONDA_DIR/share/jupyter/lab/staging &&     rm -rf /home/$NB_USER/.cache/yarn &&     fix-permissions $CONDA_DIR &&     fix-permissions /home/$NB_USER"
            },
            {
                "created": "2020-07-20T16:34:06.129748458Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  EXPOSE 8888",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:34:06.375095567Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ENTRYPOINT [\"tini\" \"-g\" \"--\"]",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:34:06.55878801Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  CMD [\"start-notebook.sh\"]",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:34:07.019257339Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) COPY multi:e4d2d8dbcb191c5f7ca1e67bc0a68ca3efaf7ca36b4c0d5eea05d30b01820cba in /usr/local/bin/ "
            },
            {
                "created": "2020-07-20T16:34:07.239205911Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) COPY file:cd827a3a9853bdea9decd0b6548b957cbe9821532361805d99dee359cfbbd1c0 in /etc/jupyter/ "
            },
            {
                "created": "2020-07-20T16:34:07.447243845Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  USER root",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:34:08.692850612Z",
                "created_by": "|1 PYTHON_VERSION=default /bin/bash -o pipefail -c fix-permissions /etc/jupyter/"
            },
            {
                "created": "2020-07-20T16:34:08.898441783Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  USER 1000",
                "empty_layer": true
            },
            {
                "created": "2020-07-20T16:34:09.14903861Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) WORKDIR /home/jovyan",
                "empty_layer": true
            },
            {
                "created": "2020-07-31T10:22:02.804876874Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  MAINTAINER Project Jupyter <[email protected]>",
                "author": "Project Jupyter <[email protected]>",
                "empty_layer": true
            },
            {
                "created": "2020-07-31T10:22:03.085613338Z",
                "created_by": "/bin/bash -o pipefail -c #(nop) ADD file:bcc8599841ae3d82e27cfe7a812a57eb854c16d52c26abbc9b259da6b294d27f in /tmp/install_jupyterhub ",
                "author": "Project Jupyter <[email protected]>"
            },
            {
                "created": "2020-07-31T10:22:03.301082055Z",
                "created_by": "/bin/bash -o pipefail -c #(nop)  ARG JUPYTERHUB_VERSION=master",
                "author": "Project Jupyter <[email protected]>",
                "empty_layer": true
            },
            {
                "created": "2020-07-31T10:22:38.17249833Z",
                "created_by": "|1 JUPYTERHUB_VERSION=0.9 /bin/bash -o pipefail -c python3 /tmp/install_jupyterhub &&     python3 -m pip install notebook",
                "author": "Project Jupyter <[email protected]>"
            }
        ],
        "NamesHistory": null
    }
]

and the container inspect for the container made with the Python API:

Python API Container Inspect
$ podman container inspect a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604
[
    {
        "Id": "a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604",
        "Created": "2020-09-08T05:54:57.063997704Z",
        "Path": "tini",
        "Args": [
            "-g",
            "--",
            "start-notebook.sh"
        ],
        "State": {
            "OciVersion": "1.0.2-dev",
            "Status": "configured",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "0001-01-01T00:00:00Z",
            "FinishedAt": "0001-01-01T00:00:00Z",
            "Healthcheck": {
                "Status": "",
                "FailingStreak": 0,
                "Log": null
            }
        },
        "Image": "f98c2844eec476cbb932cb58def069bcd5cff8f674978881fc055bcf0693ec19",
        "ImageName": "docker.io/jupyterhub/singleuser:latest",
        "Rootfs": "",
        "Pod": "",
        "ResolvConfPath": "/var/run/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/resolv.conf",
        "HostnamePath": "/var/run/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/hostname",
        "HostsPath": "/var/run/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/hosts",
        "StaticDir": "/var/lib/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata",
        "OCIConfigPath": "/var/lib/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/config.json",
        "OCIRuntime": "runc",
        "LogPath": "/var/lib/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/ctr.log",
        "LogTag": "",
        "ConmonPidFile": "/var/run/containers/storage/overlay-containers/a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604/userdata/conmon.pid",
        "Name": "stupefied_napier",
        "RestartCount": 0,
        "Driver": "overlay",
        "MountLabel": "system_u:object_r:container_file_t:s0:c63,c267",
        "ProcessLabel": "system_u:system_r:container_t:s0:c63,c267",
        "AppArmorProfile": "",
        "EffectiveCaps": null,
        "BoundingCaps": [
            "CAP_AUDIT_WRITE",
            "CAP_CHOWN",
            "CAP_DAC_OVERRIDE",
            "CAP_FOWNER",
            "CAP_FSETID",
            "CAP_KILL",
            "CAP_MKNOD",
            "CAP_NET_BIND_SERVICE",
            "CAP_NET_RAW",
            "CAP_SETFCAP",
            "CAP_SETGID",
            "CAP_SETPCAP",
            "CAP_SETUID",
            "CAP_SYS_CHROOT"
        ],
        "ExecIDs": [],
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/containers/storage/overlay/1b89d8d85ea7f40093b690a78a0fa19d028418f41c0bfb3660fdba9ccfe5e3cc/diff:/var/lib/containers/storage/overlay/6e97361a4c0f6238f3f847bbbd84e476f3d12db6a75d524cdaa9c9d3b7641b1c/diff:/var/lib/containers/storage/overlay/1a759e27e0fc9122830680f71fe9c6dc71570dadd84e65bc08a2643eff87eadf/diff:/var/lib/containers/storage/overlay/333ffdfeeda6f14ab81ec3159f26c42f5c8514bc943b684c90ed98adef0d3dca/diff:/var/lib/containers/storage/overlay/f8c412df741909af0a20553b43c0a3895cee40317fc812f44572c9f04eaa66f2/diff:/var/lib/containers/storage/overlay/618a3af6a816f4d7fe48810ce798dd43e1277c39d85c8fa3144f20e6ccaa6193/diff:/var/lib/containers/storage/overlay/e74ffc54c99cd259134e36b203c6ab005df0bfd03efb68b5e1404071b6f1fc7d/diff:/var/lib/containers/storage/overlay/1ea64673d3aed0ab4c524a06f66b12275ea9e811d83763cedcf87a643d10b2a9/diff:/var/lib/containers/storage/overlay/47d3ba77a6da5e64f5dd3f3103729c41d4ea28dd3acf4eda6aa3deabc0a6ba3e/diff:/var/lib/containers/storage/overlay/0f13289ee6047a0af2c2da72fde4b07dde2760c6bd5ffbfdff50d18964a9f3e4/diff:/var/lib/containers/storage/overlay/103b666a8482eebcd34b088eea2b8955bfdca9280b4b802c15b1a06bf72bfc9e/diff:/var/lib/containers/storage/overlay/a365215521412762b731791a4e98169577428f319cadbbaca54c6b2d857cb37f/diff:/var/lib/containers/storage/overlay/626699adc61f1d9a01899423de78c7b875d9f4fa8c156d78cca37a1e8586458e/diff:/var/lib/containers/storage/overlay/7ee3433ebdb9fcfd9e1921e98ce740895e4f7fe0d23a4ce0e7a8ad2cc898f07f/diff:/var/lib/containers/storage/overlay/c5914a774f598d300553acb5dc31da85e04f813cfab7744db900e94c289d1af2/diff:/var/lib/containers/storage/overlay/60a71c5e6c29304f84beb1a85400368c5646b0b0e01c5a10ff50f7693fe60ffa/diff:/var/lib/containers/storage/overlay/3f9c2b6d8dddbad5d70cc4ccdcb4f6f68c1b65f6718dd3efac794a5035d64183/diff:/var/lib/containers/storage/overlay/df1094fb82405e981824e9705aca12f396d8175c0bd0fd6bb97c7a4f49d1ec88/diff:/var/lib/containers/storage/overlay/d22cfd6a8b16689838c570b91794ed18acc752a08a10bce891cc64acc1533b3f/diff",
                "UpperDir": "/var/lib/containers/storage/overlay/81261f5e99a1a46fa7717881d1c44fb72e388bbd2a4a4fde0bf8f72755d2629b/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/81261f5e99a1a46fa7717881d1c44fb72e388bbd2a4a4fde0bf8f72755d2629b/work"
            }
        },
        "Mounts": [],
        "Dependencies": [],
        "NetworkSettings": {
            "EndpointID": "",
            "Gateway": "",
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "MacAddress": "",
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": ""
        },
        "ExitCommand": [
            "/usr/bin/podman",
            "--root",
            "/var/lib/containers/storage",
            "--runroot",
            "/var/run/containers/storage",
            "--log-level",
            "error",
            "--cgroup-manager",
            "systemd",
            "--tmpdir",
            "/var/run/libpod",
            "--runtime",
            "runc",
            "--storage-driver",
            "overlay",
            "--events-backend",
            "file",
            "container",
            "cleanup",
            "a07d93be42c8c13e39b4185c1fb16c9677b3f99da1c15c15728348085998d604"
        ],
        "Namespace": "",
        "IsInfra": false,
        "Config": {
            "Hostname": "a07d93be42c8",
            "Domainname": "",
            "User": "1000",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
                "TERM=xterm",
                "HOSTNAME=a07d93be42c8",
                "LANGUAGE=en_US.UTF-8",
                "CONDA_VERSION=4.8.3",
                "NB_USER=jovyan",
                "MINICONDA_VERSION=4.8.3",
                "SHELL=/bin/bash",
                "LC_ALL=en_US.UTF-8",
                "container=podman",
                "NB_GID=100",
                "LANG=en_US.UTF-8",
                "DEBIAN_FRONTEND=noninteractive",
                "HOME=/home/jovyan",
                "NB_UID=1000",
                "CONDA_DIR=/opt/conda",
                "MINICONDA_MD5=d63adf39f2c220950a063e0529d4ff74"
            ],
            "Cmd": [
                "start-notebook.sh"
            ],
            "Image": "docker.io/jupyterhub/singleuser:latest",
            "Volumes": null,
            "WorkingDir": "/home/jovyan",
            "Entrypoint": "tini -g --",
            "OnBuild": null,
            "Labels": {
                "maintainer": "Jupyter Project <[email protected]>"
            },
            "Annotations": {
                "io.container.manager": "libpod",
                "io.kubernetes.cri-o.Created": "2020-09-08T05:54:57.063997704Z",
                "io.kubernetes.cri-o.TTY": "false",
                "io.podman.annotations.autoremove": "FALSE",
                "io.podman.annotations.init": "FALSE",
                "io.podman.annotations.privileged": "FALSE",
                "io.podman.annotations.publish-all": "FALSE",
                "org.opencontainers.image.stopSignal": "15"
            },
            "StopSignal": 15
        },
        "HostConfig": {
            "Binds": [],
            "CgroupMode": "host",
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "k8s-file",
                "Config": null
            },
            "NetworkMode": "bridge",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": [],
            "CapDrop": [],
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": [],
            "GroupAdd": [],
            "IpcMode": "private",
            "Cgroup": "",
            "Cgroups": "default",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "private",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [],
            "Tmpfs": {},
            "UTSMode": "private",
            "UsernsMode": "",
            "ShmSize": 65536000,
            "Runtime": "oci",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": [
                {
                    "Name": "RLIMIT_NOFILE",
                    "Soft": 1048576,
                    "Hard": 1048576
                },
                {
                    "Name": "RLIMIT_NPROC",
                    "Soft": 4194304,
                    "Hard": 4194304
                }
            ],
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        }
    }
]

and by the CLI:

CLI Container Inspect
$ podman container inspect daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475
[
    {
        "Id": "daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475",
        "Created": "2020-09-08T06:01:22.73682913Z",
        "Path": "tini",
        "Args": [
            "-g",
            "--",
            "start-notebook.sh"
        ],
        "State": {
            "OciVersion": "1.0.2-dev",
            "Status": "configured",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "0001-01-01T00:00:00Z",
            "FinishedAt": "0001-01-01T00:00:00Z",
            "Healthcheck": {
                "Status": "",
                "FailingStreak": 0,
                "Log": null
            }
        },
        "Image": "f98c2844eec476cbb932cb58def069bcd5cff8f674978881fc055bcf0693ec19",
        "ImageName": "docker.io/jupyterhub/singleuser:latest",
        "Rootfs": "",
        "Pod": "",
        "ResolvConfPath": "",
        "HostnamePath": "",
        "HostsPath": "",
        "StaticDir": "/var/lib/containers/storage/overlay-containers/daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475/userdata",
        "OCIRuntime": "runc",
        "LogPath": "/var/lib/containers/storage/overlay-containers/daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475/userdata/ctr.log",
        "LogTag": "",
        "ConmonPidFile": "/var/run/containers/storage/overlay-containers/daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475/userdata/conmon.pid",
        "Name": "zealous_shaw",
        "RestartCount": 0,
        "Driver": "overlay",
        "MountLabel": "system_u:object_r:container_file_t:s0:c468,c770",
        "ProcessLabel": "system_u:system_r:container_t:s0:c468,c770",
        "AppArmorProfile": "",
        "EffectiveCaps": null,
        "BoundingCaps": [
            "CAP_AUDIT_WRITE",
            "CAP_CHOWN",
            "CAP_DAC_OVERRIDE",
            "CAP_FOWNER",
            "CAP_FSETID",
            "CAP_KILL",
            "CAP_MKNOD",
            "CAP_NET_BIND_SERVICE",
            "CAP_NET_RAW",
            "CAP_SETFCAP",
            "CAP_SETGID",
            "CAP_SETPCAP",
            "CAP_SETUID",
            "CAP_SYS_CHROOT"
        ],
        "ExecIDs": [],
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/containers/storage/overlay/1b89d8d85ea7f40093b690a78a0fa19d028418f41c0bfb3660fdba9ccfe5e3cc/diff:/var/lib/containers/storage/overlay/6e97361a4c0f6238f3f847bbbd84e476f3d12db6a75d524cdaa9c9d3b7641b1c/diff:/var/lib/containers/storage/overlay/1a759e27e0fc9122830680f71fe9c6dc71570dadd84e65bc08a2643eff87eadf/diff:/var/lib/containers/storage/overlay/333ffdfeeda6f14ab81ec3159f26c42f5c8514bc943b684c90ed98adef0d3dca/diff:/var/lib/containers/storage/overlay/f8c412df741909af0a20553b43c0a3895cee40317fc812f44572c9f04eaa66f2/diff:/var/lib/containers/storage/overlay/618a3af6a816f4d7fe48810ce798dd43e1277c39d85c8fa3144f20e6ccaa6193/diff:/var/lib/containers/storage/overlay/e74ffc54c99cd259134e36b203c6ab005df0bfd03efb68b5e1404071b6f1fc7d/diff:/var/lib/containers/storage/overlay/1ea64673d3aed0ab4c524a06f66b12275ea9e811d83763cedcf87a643d10b2a9/diff:/var/lib/containers/storage/overlay/47d3ba77a6da5e64f5dd3f3103729c41d4ea28dd3acf4eda6aa3deabc0a6ba3e/diff:/var/lib/containers/storage/overlay/0f13289ee6047a0af2c2da72fde4b07dde2760c6bd5ffbfdff50d18964a9f3e4/diff:/var/lib/containers/storage/overlay/103b666a8482eebcd34b088eea2b8955bfdca9280b4b802c15b1a06bf72bfc9e/diff:/var/lib/containers/storage/overlay/a365215521412762b731791a4e98169577428f319cadbbaca54c6b2d857cb37f/diff:/var/lib/containers/storage/overlay/626699adc61f1d9a01899423de78c7b875d9f4fa8c156d78cca37a1e8586458e/diff:/var/lib/containers/storage/overlay/7ee3433ebdb9fcfd9e1921e98ce740895e4f7fe0d23a4ce0e7a8ad2cc898f07f/diff:/var/lib/containers/storage/overlay/c5914a774f598d300553acb5dc31da85e04f813cfab7744db900e94c289d1af2/diff:/var/lib/containers/storage/overlay/60a71c5e6c29304f84beb1a85400368c5646b0b0e01c5a10ff50f7693fe60ffa/diff:/var/lib/containers/storage/overlay/3f9c2b6d8dddbad5d70cc4ccdcb4f6f68c1b65f6718dd3efac794a5035d64183/diff:/var/lib/containers/storage/overlay/df1094fb82405e981824e9705aca12f396d8175c0bd0fd6bb97c7a4f49d1ec88/diff:/var/lib/containers/storage/overlay/d22cfd6a8b16689838c570b91794ed18acc752a08a10bce891cc64acc1533b3f/diff",
                "UpperDir": "/var/lib/containers/storage/overlay/dfc8276bb474890bb1b1befbb8c9e5503a1544b193325fb64a3927d6f33fce90/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/dfc8276bb474890bb1b1befbb8c9e5503a1544b193325fb64a3927d6f33fce90/work"
            }
        },
        "Mounts": [],
        "Dependencies": [],
        "NetworkSettings": {
            "EndpointID": "",
            "Gateway": "",
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "MacAddress": "",
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": ""
        },
        "ExitCommand": [
            "/usr/bin/podman",
            "--root",
            "/var/lib/containers/storage",
            "--runroot",
            "/var/run/containers/storage",
            "--log-level",
            "error",
            "--cgroup-manager",
            "systemd",
            "--tmpdir",
            "/var/run/libpod",
            "--runtime",
            "runc",
            "--storage-driver",
            "overlay",
            "--events-backend",
            "file",
            "container",
            "cleanup",
            "daaa730a2b97ca9f7bcc586812726b30bb88c81fcfa7d7ebaa9c62d13c140475"
        ],
        "Namespace": "",
        "IsInfra": false,
        "Config": {
            "Hostname": "daaa730a2b97",
            "Domainname": "",
            "User": "1000",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TERM=xterm",
                "CONDA_VERSION=4.8.3",
                "LC_ALL=en_US.UTF-8",
                "LANG=en_US.UTF-8",
                "CONDA_DIR=/opt/conda",
                "NB_GID=100",
                "NB_USER=jovyan",
                "DEBIAN_FRONTEND=noninteractive",
                "MINICONDA_VERSION=4.8.3",
                "container=podman",
                "LANGUAGE=en_US.UTF-8",
                "MINICONDA_MD5=d63adf39f2c220950a063e0529d4ff74",
                "NB_UID=1000",
                "SHELL=/bin/bash",
                "HOME=/home/jovyan",
                "HOSTNAME="
            ],
            "Cmd": [
                "start-notebook.sh"
            ],
            "Image": "docker.io/jupyterhub/singleuser:latest",
            "Volumes": null,
            "WorkingDir": "/home/jovyan",
            "Entrypoint": "tini -g --",
            "OnBuild": null,
            "Labels": {
                "maintainer": "Jupyter Project <[email protected]>"
            },
            "Annotations": {
                "io.kubernetes.cri-o.TTY": "false",
                "io.podman.annotations.autoremove": "FALSE",
                "io.podman.annotations.init": "FALSE",
                "io.podman.annotations.privileged": "FALSE",
                "io.podman.annotations.publish-all": "FALSE"
            },
            "StopSignal": 15,
            "CreateCommand": [
                "podman",
                "container",
                "create",
                "jupyterhub/singleuser:latest"
            ]
        },
        "HostConfig": {
            "Binds": [],
            "CgroupMode": "host",
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "k8s-file",
                "Config": null
            },
            "NetworkMode": "bridge",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": [],
            "CapDrop": [],
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": [],
            "GroupAdd": [],
            "IpcMode": "private",
            "Cgroup": "",
            "Cgroups": "default",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "private",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [],
            "Tmpfs": {},
            "UTSMode": "private",
            "UsernsMode": "",
            "ShmSize": 65536000,
            "Runtime": "oci",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": 0,
            "OomKillDisable": false,
            "PidsLimit": 2048,
            "Ulimits": [
                {
                    "Name": "RLIMIT_NOFILE",
                    "Soft": 1048576,
                    "Hard": 1048576
                },
                {
                    "Name": "RLIMIT_NPROC",
                    "Soft": 4194304,
                    "Hard": 4194304
                }
            ],
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        }
    }
]

And here is system/version info:

$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
$ podman --version
podman version 2.0.6
$ python -m pip freeze | grep podman
podman==1.6.1.dev50
$ python -m pip freeze | grep varlink
varlink==30.3.0

I was previously running podman version 1.6.4, from the default Centos repositories, paired with the default python-podman version from the PyPi repository, but I was experiencing the same behavior before and after both upgrades.

I've read elsewhere that this might have to do with the container's file system not mounting correctly? Perhaps there is also something simple I am missing in how to use the Python API. Any help is appreciated!

history() doesn't work

import podman

pclient = podman.Client()

img = pclient.images.get('6c0fc7ee13e0')

for his in img.history():
print(his)

fails with :
Traceback (most recent call last):
File "test.py", line 11, in
for his in img.history():
TypeError: 'list' object is not callable

problem is that when Image object is created, it defines attribute history and sets it to '[]'

which overrides history() method

podman version: podman-2.0.6-1.fc32.x86_64
python podman version: 1.6.0

pypodman: publish to pypi

kind feature

Description

The python library, pypodman, is not published to PyPI. This makes it harder for folks to write python code that depends on it.

clarify LICENSE situation

Currently there are two license files (LICENSE & LICENSE.txt) which seem redundant. Podman itself just uses one LICENSE file.

This should IMO be deduplicated.

[Questions] related to the varlink server address format

Hello,

Do you seen any reasons (that I maybe missed) to limit the client uri to a local path (i.e unix:/run/podman/io.podman)?

If I'm right varlink also accept tcp addresses (i.e tcp://127.0.0.1:38005) and in this case podman specifically ignore them.

  • Do you you have any reasons to ignore this kind of address (tcp format)?
  • Do you think that we could adapt this code to allow users to pass tcp format too?

To allow you to better understand our needs and why I ask these questions lets me explains a little bit our situation. I implemented a podman client in tobiko (a new testing framework for openstack) and tobiko establish an SSH connection to the openstack node (controller, compute, etc) and then it proxifying server connections through tcp to allow us to centralize SSH config and mechanismes in only one place.

For these reasons we prefer to pass through a proxified python-podman LocalClient and ssh/tcp rather than using a python-podman RemoteClient and a direct usage of SSH with python-podman.

Example with the code bellow:

from tobiko.shell import ssh
from tobiko.tripleo import overcloud

ssh_client = overcloud.overcloud_ssh_client('controller-0')
uri = 'unix:/run/podman/io.podman'
print(ssh.get_port_forward_url(ssh_client=ssh_client, url=uri))
# will print 'tcp://127.0.0.1:38005'

The previous code opened a SSH connection on the controller-0 of the openstack tripleo's overcloud and then we proxify the varlink connection through tcp by calling ssh.get_port_forward_url which will return the proxified podman's varlink server address and so, now, we would like to use it with a python-podman LocalClient and we facing the previous described python-podman's limitation.

I hope these infos help you to understand our use case.

For further reading you can also take a look to https://review.opendev.org/#/c/700527/

If you need more info do not hesitate to ask questions I will be happy to help you.

Missing package version

Now that the package is no longer under the libpod repository, should it be versioned independently?

If so, one should have in mind that the last release on pypi was 0.11.1.1 (it would also be nice to Tag this repository in the revision that originated the pypi release).

This issue may also be related to #25

How to use push args using SDK

I successfully used the push args through cmd but found that there are no options for the args using the push function.

@rhatdan Is there a way/example to use the push options through podman SDK?

Can not create a new container from an image

With python3.7 and podman installed from git in a virtualenv:

# cat reproducer.py 
import podman

with podman.Client() as client:
    image_id = client.images.pull('registry.hub.docker.com/opensuse/leap:15.1')
    image = client.images.get(image_id)
    image.create(command=['/usr/bin/top'])

I get:

# python3 reproducer.py 
Traceback (most recent call last):
  File "reproducer.py", line 6, in <module>
    image.create(command=['/usr/bin/top'])
  File ".tox/py37/lib/python3.7/site-packages/podman/libs/images.py", line 53, in create
    id_ = podman.CreateContainer(config)['container']
  File ".tox/py37/lib/python3.7/site-packages/varlink/client.py", line 86, in _wrapped
    return self._call(method.name, *args, **kwargs)
  File ".tox/py37/lib/python3.7/site-packages/varlink/client.py", line 143, in _call
    (message, more) = self._next_varlink_message()
  File ".tox/py37/lib/python3.7/site-packages/varlink/client.py", line 104, in _next_varlink_message
    message = next(self._next_message())
  File ".tox/py37/lib/python3.7/site-packages/varlink/client.py", line 265, in _next_message
    raise BrokenPipeError("Disconnected")
BrokenPipeError: Disconnected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.