-
Notifications
You must be signed in to change notification settings - Fork 120
fix: podman.domain.containers.run pulls image if not found #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tollsimy The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Simone Tollardo <simone.tollardo@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @tollsimy , I think it's a good PR, but I'd consider using the same logic that podman cli uses for this call. see my comment at the code
but maybe you thought about it, so I would like to hear your opinion on the matter.
depending on this, tests will need to be adjusted accordingly :)
| if response.status_code == requests.codes.not_found: | ||
| self.podman_client.images.pull( | ||
| image, | ||
| auth_config=kwargs.get("auth_config"), | ||
| platform=kwargs.get("platform"), | ||
| policy=kwargs.get("policy", "missing"), | ||
| ) | ||
| response = self.client.post( | ||
| "/containers/create", | ||
| headers={"content-type": "application/json"}, | ||
| data=payload, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious to see what podman cli does when you call create, so I tried. when you do podman-remote create you get a pull call no matter if the image is cached or not
POST /v5.7.0/libpod/images/pull
POST /v5.7.0/libpod/containers/create
therefore I would simply remove the if and try to pull every time you create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but podman cli default pull policy should be "missing", thus, it should not pull if the image is cached:
tollsimy@thinkpad-redhat:~$ podman pull quay.io/fedora/fedora:43
Trying to pull quay.io/fedora/fedora:43...
Getting image source signatures
Copying blob 5f0ebf85c063 skipped: already exists
Copying config ad291a240e done |
Writing manifest to image destination
ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b
tollsimy@thinkpad-redhat:~$ podman create --log-level=debug quay.io/fedora/fedora:43
INFO[0000] podman filtering at log level debug
DEBU[0000] Called create.PersistentPreRunE(podman create --log-level=debug quay.io/fedora/fedora:43)
INFO[0000] Setting parallel job count to 67
DEBU[0000] Using conmon: "/usr/bin/conmon"
INFO[0000] Using sqlite as database backend
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /var/home/tollsimy/.local/share/containers/storage
DEBU[0000] Using run root /run/user/1000/containers
DEBU[0000] Using static dir /var/home/tollsimy/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /run/user/1000/libpod/tmp
DEBU[0000] Using volume path /var/home/tollsimy/.local/share/containers/storage/volumes
DEBU[0000] Using transient store: false
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that overlay is supported
DEBU[0000] Cached value indicated that metacopy is not being used
DEBU[0000] Cached value indicated that native-diff is usable
DEBU[0000] backingFs=btrfs, projectQuotaSupported=false, useNativeDiff=true, usingMetacopy=false
DEBU[0000] Initializing event backend journald
DEBU[0000] Configured OCI runtime crun-vm initialization failed: no valid executable found for OCI runtime crun-vm: invalid argument
DEBU[0000] Configured OCI runtime crun-wasm initialization failed: no valid executable found for OCI runtime crun-wasm: invalid argument
DEBU[0000] Configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] Configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Configured OCI runtime ocijail initialization failed: no valid executable found for OCI runtime ocijail: invalid argument
DEBU[0000] Configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] Configured OCI runtime runj initialization failed: no valid executable found for OCI runtime runj: invalid argument
DEBU[0000] Configured OCI runtime youki initialization failed: no valid executable found for OCI runtime youki: invalid argument
DEBU[0000] Configured OCI runtime krun initialization failed: no valid executable found for OCI runtime krun: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"
DEBU[0000] Pulling image quay.io/fedora/fedora:43 (policy: missing)
DEBU[0000] Looking up image "quay.io/fedora/fedora:43" in local containers storage
DEBU[0000] Normalized platform linux/amd64 to {amd64 linux [] }
DEBU[0000] Trying "quay.io/fedora/fedora:43" ...
DEBU[0000] parsed reference into "[overlay@/var/home/tollsimy/.local/share/containers/storage+/run/user/1000/containers]@ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Found image "quay.io/fedora/fedora:43" as "quay.io/fedora/fedora:43" in local containers storage
DEBU[0000] Found image "quay.io/fedora/fedora:43" as "quay.io/fedora/fedora:43" in local containers storage ([overlay@/var/home/tollsimy/.local/share/containers/storage+/run/user/1000/containers]@ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b)
DEBU[0000] exporting opaque data as blob "sha256:ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Looking up image "quay.io/fedora/fedora:43" in local containers storage
DEBU[0000] Normalized platform linux/amd64 to {amd64 linux [] }
DEBU[0000] Trying "quay.io/fedora/fedora:43" ...
DEBU[0000] parsed reference into "[overlay@/var/home/tollsimy/.local/share/containers/storage+/run/user/1000/containers]@ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Found image "quay.io/fedora/fedora:43" as "quay.io/fedora/fedora:43" in local containers storage
DEBU[0000] Found image "quay.io/fedora/fedora:43" as "quay.io/fedora/fedora:43" in local containers storage ([overlay@/var/home/tollsimy/.local/share/containers/storage+/run/user/1000/containers]@ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b)
DEBU[0000] exporting opaque data as blob "sha256:ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Inspecting image ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b
DEBU[0000] exporting opaque data as blob "sha256:ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Inspecting image ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b
DEBU[0000] Inspecting image ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b
DEBU[0000] using systemd mode: false
DEBU[0000] No hostname set; container's hostname will default to runtime default
DEBU[0000] Loading seccomp profile from "/usr/share/containers/seccomp.json"
DEBU[0000] Allocated lock 108 for container 12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22
DEBU[0000] exporting opaque data as blob "sha256:ad291a240ef9da8feda7517b3757f4bb9b1af017df724110e96472f34fa5103b"
DEBU[0000] Cached value indicated that idmapped mounts for overlay are not supported
DEBU[0000] Check for idmapped mounts support
DEBU[0000] Created container "12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22"
DEBU[0000] Container "12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22" has work directory "/var/home/tollsimy/.local/share/containers/storage/overlay-containers/12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22/userdata"
DEBU[0000] Container "12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22" has run directory "/run/user/1000/containers/overlay-containers/12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22/userdata"
12410d146b11430b5bfee809b0e435a237bd429808c916c30d808e9e89959f22
DEBU[0000] Called create.PersistentPostRunE(podman create --log-level=debug quay.io/fedora/fedora:43)
DEBU[0000] Shutting down engines
INFO[0000] Received shutdown.Stop(), terminating! PID=9333
I guess podman-remote needs to query remote container storage so that's why you see the POST libpod/images/pull request.
Fixes: