Skip to content

Commit b8c0c85

Browse files
committed
Fix README TypeError when one container is running
closes #379 Signed-off-by: Nicola Sella <[email protected]>
1 parent 0f2f714 commit b8c0c85

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ with PodmanClient(base_url=uri) as client:
3535

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

4245
# available fields
4346
print(sorted(container.attrs.keys()))

0 commit comments

Comments
 (0)