If you try to run a container whose image hasn't yet been downloaded then an attribute error will be thrown because the APIClient doesn't have an attribute named "images".
Example script:
from podman import PodmanClient
with PodmanClient.from_env() as client:
client.containers.run(image='ubuntu')
output:
Traceback (most recent call last):
File "/Users/matt/.env/lib/python3.11/site-packages/podman/domain/containers_run.py", line 61, in run
container = self.create(image=image, command=command, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/matt/.env/lib/python3.11/site-packages/podman/domain/containers_create.py", line 354, in create
response.raise_for_status(not_found=ImageNotFound)
File "/Users/matt/.env/lib/python3.11/site-packages/podman/api/client.py", line 74, in raise_for_status
raise not_found(cause, response=self._response, explanation=message)
podman.errors.exceptions.ImageNotFound: 404 Client Error: Not Found (no such image: ubuntu: image not known)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/matt/test.py", line 4, in <module>
client.containers.run(image='ubuntu')
File "/Users/matt/.env/lib/python3.11/site-packages/podman/domain/containers_run.py", line 63, in run
self.client.images.pull(image, platform=kwargs.get("platform"))
^^^^^^^^^^^^^^^^^^
AttributeError: 'APIClient' object has no attribute 'images'
If you try to run a container whose image hasn't yet been downloaded then an attribute error will be thrown because the APIClient doesn't have an attribute named "images".
Example script:
output: