Open
Description
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
.