containers / containers/podman-py

GET operation failed - when running podman as sudo

Open
#455 5 comments 1 reaction 0 assignees View on GitHub
bug good first issue
Dominant language
Python
Stars
381
Forks
140
Avg merge
5h 30m
Merged PRs (30d)
1

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
```python
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:

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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.