Skip to content
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

Allow docker client to negotiate the API version with the server #2260

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

bainsy88
Copy link
Contributor

The version is currently hardcoded which is causing the issue documented here - #2259

Decided adding a unit test wasn't feasible as as the version would change each time we pulled in a new docker client and as long as it negotiates a version that works I suspect we don't care what that exact version is.

…er than hardcoding

Signed-off-by: jack-baines <jack.baines@uk.ibm.com>
@TomSweeneyRedHat
Copy link
Member

The change Looks good for what you're trying to do. I'm just a bit hesitant to drop the test. I'd lean towards bumping the default version to 1.24 instead. @mtrmac WDYT?

Regardless, TYVM for the PR @bainsy88

@TomSweeneyRedHat
Copy link
Member

This is a different approach to solving the problem as #2258

@bainsy88
Copy link
Contributor Author

Ah I hadn't noticed the other PR which beat me to it. Happy to go with the other one given it already had tests and that was a concern with this change

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

  • Version negotiation ends up being better than hard-coding; with negotiation, there is a chance for the client & server to use a mutually-intelligible version larger than 1.24 (and version negotiation exists since 1.24, so hard-coding a requirement for 1.24 without negotiation is no less restrictive. Opting into version negotiation does interoperate with <1.24… using the 1.24 semantics. So version negotiation is at least as compatible as hard-coding 1.24, and more compatible long-term).
  • We do need to actually enable version negotiation to benefit that way, though. This PR does not currently do that, AFAICT. (And the Docker CLI does opt into version negotiation, which is another reason to do the same thing.)
  • (The history is that the code was originally written when there was no version negotiation (in the client libraries at least); there is a fairly extensive discussion about the trade-offs at the time in Issue #327 Creating Docker client from env settings #328 , but just during that time version negotiation was being added to the client libraries…)
  • I’m fine with removing the tests checking the client’s properties. The client’s configuration applied based on the options is, for the most part, not inspectable, we just have to trust that the client initialization would fail if we gave it nonsensical instructions.

docker/daemon/client.go Show resolved Hide resolved
@bainsy88
Copy link
Contributor Author

I have built skopeo off this code and added some additional debug so can see the client version is 1.44 but it negotiates it down to 1.43 when I run against Docker 24.0.7

@mtrmac
Copy link
Collaborator

mtrmac commented Jan 24, 2024

Confirming that code from this PR works with both Docker 24 and 25.

Alternatively, a workaround:

# cat /etc/systemd/system/docker.service.d/version.conf 
[Service]
Environment=DOCKER_MIN_API_VERSION=1.22

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, to both @bainsy88 and @dpeckett !

@mtrmac mtrmac merged commit 3e5b951 into containers:main Jan 24, 2024
10 checks passed
@TomSweeneyRedHat
Copy link
Member

Yes, @bainsy88 and @dpeckett TY both very much for this discussion and change.

bell-sw pushed a commit to bell-sw/alpaquita-aports that referenced this pull request Jan 26, 2024
Updating a vendored dependency to enable Docker Client API
version negotiation:

  containers/image#2260

and, in particular, make skopeo work with Docker 25.
TomSweeneyRedHat added a commit to TomSweeneyRedHat/image that referenced this pull request Jan 30, 2024
Backport the fix from main for containers#2260 to allow
for the lastest Docker Daemons to work with c/image.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
mtrmac added a commit that referenced this pull request Jan 30, 2024
Backport Docker Daemon fix #2260, bump to 5.29.2, then 5.29.3-dev
atmosphere-ci bot pushed a commit to vexxhost/atmosphere that referenced this pull request Apr 21, 2024
…1114)

This PR contains the following updates:



Package
Change
Age
Adoption
Passing
Confidence




github.com/containers/image/v5
v5.29.2 -> v5.30.0








WarningSome dependencies could not be looked up. Check the warning logs for more information.


Release Notes

containers/image (github.com/containers/image/v5)
v5.30.0
Compare Source
What's Changed
A fair number of improvements when working with zstd and zstd:chunked-compressed images.
Note that make install now installs policy.json and registries.d/default.yaml.

Refuse compression to zstd when using schema1 by @​mtrmac in containers/image#2196
Don't expose local account details in oci-archive tar files by @​mtrmac in containers/image#2202
Trigger a conversion to OCI when compressing to Zstd by @​mtrmac in containers/image#2204
Add buildtags to avoid fulcio and rekor dependencies by @​siretart in containers/image#2180
copy: do not fail if digest mismatches by @​giuseppe in containers/image#1980
Moving policy.json and default.yaml from containers/skopeo by @​rahilarious in containers/image#2215
Embrace codespell: config, workflow (to alert when new typos added) and get typos fixed by @​yarikoptic in containers/image#2214
Fix raspberry pi zero cpu variant recognition by @​lstolcman in containers/image#2086
storage: validate images converted to zstd:chunked by @​giuseppe in containers/image#2243
Make blob reuse choices manifest-format-sensitive, and allow conversions when writing to format-agnostic transports by @​mtrmac in containers/image#2213
Edit the manifest when pushing uncompressed data from c/storage by @​mtrmac in containers/image#2273
Random storage-related cleanups by @​mtrmac in containers/image#2287
Improve storage transport documentation, primarily about locking by @​mtrmac in containers/image#2291
Fix c/storage destination with partial pulls by @​mtrmac in containers/image#2288
Fix manifest updates when we match a layer by TOC digest by @​mtrmac in containers/image#2294
Cleanly fail when trying to obtain a DiffID of a non-OCI image by @​mtrmac in containers/image#2295
Beautify TOC-related parts of storageImageSource by @​mtrmac in containers/image#2296
storage: use the new ApplyStagedLayer interface by @​giuseppe in containers/image#2301
Also annotate image instances using zstd:chunked as using zstd by @​mtrmac in containers/image#2302
Support editing ArtifactType, preserve it in lists by @​nalind in containers/image#2304
Provide data to correctly report throughput on partial pulls by @​mtrmac in containers/image#2308
Add validation error to digesting reader by @​saschagrunert in containers/image#2312
Fix handling of errors when fetching layers by URLs by @​mtrmac in containers/image#2310
Improve handling of zstd vs. zstd:chunked matching by @​mtrmac in containers/image#2317

New Contributors

@​rahilarious made their first contribution in containers/image#2215
@​yarikoptic made their first contribution in containers/image#2214
@​lstolcman made their first contribution in containers/image#2086
@​bainsy88 made their first contribution in containers/image#2260

Full Changelog: containers/image@v5.29.2...v5.30.0


Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.


 If you want to rebase/retry this PR, check this box


This PR has been generated by Mend Renovate. View repository job log here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A defect in an existing functionality (or a PR fixing it)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker client code can no longer talk to the latest verson of the docker daemon 25.0.0
3 participants