Open GrabbenD opened 1 year ago
See comment: https://github.com/containers/podman/issues/20125#issuecomment-1733258118 I think it should help.
Thanks, that makes sense @flouthoc!
I think something is wrong through:
$ podman build -f Containerfile.extended --pull=true
STEP 1/1: FROM mylocalimage
Trying to pull localhost/mylocalimage:latest...
WARN[0000] Failed, retrying in 2s ... (1/3). Error: initializing source docker://localhost/mylocalimage:latest: pinging container registry localhost: Get "https://localhost/v2/": dial tcp [::1]:443: connect: connection refused
After reading PR changes here https://github.com/containers/podman/pull/20124 I think maybe buildah documentation is also not correct, lets wait for comments on PR
--pull=always
on an image with localhost
is not strictly related to the docs issue. What it boils down to is: Do we want to "relax" the always
pull policy when the reference points to localhost/
?
I feel rather against it, because --pull=always
instructs to always pull. Podman has no knowledge whether the user is referencing a local-only image or not. So I prefer users who decide for --pull=always
to make a conscious decision about it.
Note that I have https://github.com/containers/podman/pull/20124 open
Do we want to "relax" the always pull policy when the reference points to localhost/?
I feel rather against it, because --pull=always instructs to always pull. Podman has no knowledge whether the user is referencing a local-only image or not. So I prefer users who decide for --pull=always to make a conscious decision about it.
I agree with your assessment
What about a new relaxed
option which only forcefully pulls external images but not localhost/
?
Localhost images are already up to date as they're built locally in the first place 🙂
(This is probably only useful for people like me who would like to re-use the same Podman options for building local and external images)
@GrabbenD, did you checkout --pull=newer
? This will always pull an image if there's a newer one on the registry. If the registry cannot be reached, the local one would be used.
@vrothberg Tried it but there's no logs which confirms that my current (external) image is up to date with upstream repo (which makes me confused if it works as the build completes instantaneously) and the documentation advised against newer
option as comparing timestamps is prone to errors? Maybe I'm overthinking it? 🙂
@GrabbenD I think the docs may have confused you. It states that "Comparing the time stamps is prone to errors." but newer
is not comparing those but "An image is considered to be newer when the digests are different".
In other words: an image in the local storage will only repulled if the digest on the registry differs.
but there's no logs which confirms that my current (external) image is up to date with upstream repo
Which kind of logs (and where) are you looking for?
That makes sense, yes the documentation was confusing.
Which kind of logs (and where) are you looking for?
For comparison, console logs from $ podman build -f Containerfile.base --pull=always
with external image makes it clear that something is going on:
Copying blob 38f5a258dd4f skipped: already exists
In contrast, --pull=newer
doesn't print anything to the console at all (which is the same behavior as --pull=missing
option or --pull=invalidoptionhere
, there's no indication that it works or if something is wrong).
You would like a Debug message saying the image was not pulled?
You would like a Debug message saying the image was not pulled?
Yes, I believe it would be very helpful in seeing what's actually going on (e.g. if something is misspelled) since right now you can't the difference when it's working and when the flag is invalid
(p.s. sorry for the late reply)
A friendly reminder that this issue had no activity for 30 days.
(Ticket is still relevant @github-actions)
@flouthoc PTAL
A friendly reminder that this issue had no activity for 30 days.
(@github-actions bump)
Issue Description
--pull=always
flag in$ podman build
is not compatible with locally built images. Locally built images are automatically prefixed withlocalhost/
which makes--pull=always
think it's a locally hosted repository.This does not seem to be the case with
--pull=newer
as it doesn't complain about network failure.Related discussion: https://github.com/containers/podman/discussions/20121
Steps to reproduce the issue
Steps to reproduce the issue
$ less Containerfile.base
$ podman build -f Containerfile.base -t mylocalimage --pull=always
$ less Containerfile.extended
$ podman build -f Containerfile.extended --pull=always
$ podman image ls
(Not related to this issue but I don't know why it thinks it was created 3 days ago when I just made it
$ date
(Mon Sep 25 09:13:50 AM UTC 2023))Describe the results you received
--pull=always
pings localhost instead of querying local imagesDescribe the results you expected
--pull=always
should realize the image is available locally instead of pinginglocalhost
Understandably the best workaround is to not specify
--pull=always
(as Podman automatically uses the newest image for locally built images) but this breaks my CI/CD workflow which uses the same parameters for building multiple Containerfiles with the same flags in a looppodman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
Additional environment details
N/A
Additional information
N/A