-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Download image when starting a container using the compat API #12315
Conversation
Docker/moby will automatically pull images when using the API (or the CLI, for that matter) to create a container, but podman don't. This break the compatibility with some software.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mscherer 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 |
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.
LGTM
In order to pass CI, you need to sign your commit via git commit --ammend -s
and repush.
@containers/podman-maintainers PTAL
Are we absolutely sure that this is what Docker does? Because Docker definitely documents that they return a 404 from the create endpoint when the image isn't present. I'd be more inclined to believe our error response is slightly wrong and it's not triggering a conditional that would normally pull the image? |
I went digging in the Moby source, and I can confirm that they do not do this - it's definitely a 404 on image not existing when Create is hit. |
Thank you for checking, @mheon! Are the Python bindings doing the pull? Just guessing. |
Possible? Didn't check around there. |
Ok, I will check woodpecker code. I just tested with docker and podman (with and without the patch), and indeed, it worked with docker, but I should have searched further rather than just jump in coding. |
Ok so indeed, here is what is returned by docker (along a 404):
and so woodpecker do "POST /v1.33/images/create?fromImage=a6543%2Ftest_git_plugin&tag=latest" I will compare with the same trace from podman. |
And what podman HEAD answer:
|
Ok so indeed, the retry is on woodpecker side on https://github.com/woodpecker-ci/woodpecker/blob/master/pipeline/backend/docker/docker.go#L91-L92
Client is from github.com/moby/moby/client, https://github.com/moby/moby/blob/master/client/errors.go#L43 So the issue is not just "some client", but anything that use the official binding. I will close that PR, try to fix, and reopen a new one once I found it. |
Would this have fixed the problem:
|
Nope. It still say "image not known" |
Or rather, the json returned is:
So it change "cause", but not "message". |
seems to work (or rather, seems to complain about "Error response from daemon: failed to resolve image name: short-name resolution enforced but cannot prompt without a TTY" (which is weird, because this is not a short-name) |
ok so the short-name issue is on woodpecker side. Just changing the message is enough to fix the logic from moby client. |
Fix containers#12315 Signed-off-by: Michael Scherer <[email protected]>
Fix containers#12315 Signed-off-by: Michael Scherer <[email protected]>
Docker/moby will automatically pull images when using the API (or the CLI, for
that matter) to create a container, but podman don't. This break the compatibility with
some software.
I tested that using woddpecker CI, and when I use docker on F35 as the backend, it doesn't fail. Using podman-docker fail, with "image uknown".
What this PR does / why we need it:
Align the compatibility API with moby.
How to verify it
There is a attached test case. Otherwise, deploying woodpecker and using podman-docker is the way to go, or do a call the
/v1.33/containers/xxxx/start API with a image not already downloaded (eg, one not in the output of podman images) and see it fail.
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
I am not 100% happy with the code, especially with the fact the call to LookupImage is duplicated. I am however not fluent enough in go to write something more idiomatic.