Skip to content

GET operation failed - when running podman as sudo #455

@D3vil0p3r

Description

@D3vil0p3r

I want to get podman info without specifying a base uri, by using podman.from_env() (as occurs for python docker lib).

When I run sudo systemctl start podman and I run the code

import podman
from podman import PodmanClient

client = podman.from_env()

print("Podman client:", client)

try:
    print("Base URL:", client.api.base_url)
    print("Version:", client.version())
    print("Client Info:", client.info())
except Exception as e:
    print("Error occurred while accessing client attributes:", e)

produces:

Podman client: <podman.client.PodmanClient object at 0x787de8633680>

Base URL: ParseResult(scheme='http+unix', netloc='%2Ftmp%2Fpodmanpy-runtime-dir-fallback-root%2Fpodman%2Fpodman.sock', path='', params='', query='', fragment='')

Error occurred while accessing client attributes: http://%2Ftmp%2Fpodmanpy-runtime-dir-fallback-root%2Fpodman%2Fpodman.sock/v5.2.0/libpod/version (GET operation failed)

The script works only if I run podman service as user by systemctl start --user podman.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions