sys: notify client-server API version mismatch#7093
Open
maksimtech wants to merge 1 commit into
Open
Conversation
Signed-off-by: Massimo Moretti <github@maksimtech.com>
thaJeztah
requested changes
Jul 8, 2026
thaJeztah
left a comment
Member
There was a problem hiding this comment.
What problem are you trying to solve? The output already indicates if the client downgraded? e.g. when running a current version of the CLI against an old (23.x) daemon;
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:cli version
Client:
Version: 29.6.1
API version: 1.42 (downgraded from 1.55)
Go version: go1.26.4
Git commit: 8900f1d
Built: Fri Jun 26 11:39:39 2026
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 23.0.4
API version: 1.42 (minimum version 1.12)
...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an explicit notification log when the Docker CLI client session API version is downgraded to match the daemon (server) version.
Currently, when the client supports a higher API version than the daemon, it silently downgrades the session API version to maintain compatibility. While this fallback mechanism works flawlessly, providing a clear note in the docker version output helps developers and administrators immediately notice that a protocol downgrade has occurred.
Changes
Modified cli/command/system/version.go.
Added a conditional check inside runVersion after the ServerVersion API call to compare the client's supported API version with the negotiated server API version.
Prints a clear message to dockerCLI.Err() if a mismatch/downgrade is detected:
Note: API version session negotiated to (Client supports ).
How to test
Build the binary locally: make binary
Run the compiled docker binary against a Docker Daemon that has a lower API version than the client:
Bash
./build/docker version
Verify that the warning note appears dynamically above the standard prettyPrintVersion output.
Checklist
[x] I have signed my commits with git commit -s (DCO checked).
[x] The code builds successfully locally.