Skip to content

Commit

Permalink
Fix README TypeError when one container is running
Browse files Browse the repository at this point in the history
closes #379

Signed-off-by: Nicola Sella <[email protected]>
  • Loading branch information
inknos committed May 30, 2024
1 parent 0f2f714 commit b8c0c85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ with PodmanClient(base_url=uri) as client:

# find all containers
for container in client.containers.list():
first_name = container['Names'][0]
container = client.containers.get(first_name)
# After a list call you would probably want to reload the container
# to get the information about the variables such as status.
# Note that list() ignores the sparse option and assumes True by default.
container.reload()
print(container, container.id, "\n")
print(container, container.status, "\n")

# available fields
print(sorted(container.attrs.keys()))
Expand Down

0 comments on commit b8c0c85

Please sign in to comment.