-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
There are many times when the Docker version on a client can differ to that on a server.
This is typically because that end users are faster to update their clients whereas hosted Docker services or servers in production are slower to upgrade.
This issue can be much worse when attempting to RC test the new version of Docker as you need to switch Docker Client versions or set DOCKER_API_VERSION. The latter can have consequences e.g newer client features and flags failing against older engine versions.
Today
Attempting to connect to older server:
$ docker ps
Error response from daemon: client is newer than server (client API version: 1.23, server API version: 1.22)
Attempting to create an IPv6 network
$ DOCKER_API_VERSION=1.22 docker network create --ipv6 foo
2d6a8ce8e8303d27fbfdc19cb1d2a73328d5d278a1dea173d31ec4b9d586e8ca
$ DOCKER_API_VERSION=1.22 docker network inspect foo
[
{
"Name": "foo",
"Id": "2d6a8ce8e8303d27fbfdc19cb1d2a73328d5d278a1dea173d31ec4b9d586e8ca",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1/16"
}
]
},
"Internal": false,
"Containers": {},
"Options": {},
"Labels": null
}
]
The command succeeds, but IPv6 wasn't enabled as this is only available in a newer API version!
Tomorrow
Regardless of version, commands should work:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Handling of unsupported operations
$ docker network create --ipv6 foo
Error: `--ipv6` is not available on your server
Client Version: 1.23
Server Version: 1.22
Suggestion
If the Docker Client were able to maintain some form of session state, it could detect and preserve the Docker API version for a session. It should also be possible to prevent newer client features from being used on servers that do not support them to avoid inconsistencies like the example noted above