Newer docker client with older Docker host
Since Docker 1.10.0, there's an option for overriding the API Version used for Docker client communication with Docker engine.
Just by using the DOCKER_API_VERSION environment variable.
Ex.:
$ docker version
Client:
Version: 1.10.0
API version: 1.22
Go version: go1.5.3
Git commit: 590d510
Built: Fri Feb 5 08:21:41 UTC 2016
OS/Arch: darwin/amd64
Error response from daemon: client is newer than server (client API version: 1.22, server API version: 1.21)
$ DOCKER_API_VERSION=1.21 docker version
Client:
Version: 1.10.0
API version: 1.21
Go version: go1.5.3
Git commit: 590d510
Built: Fri Feb 5 08:21:41 UTC 2016
OS/Arch: darwin/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: linux/amd64
Reference: https://docs.docker.com/engine/reference/commandline/cli/#environment-variables
EDIT
Since Docker 1.13, CLI has an improved backwards compatibility. According to https://blog.docker.com/2017/01/whats-new-in-docker-1-13 :
Starting with 1.13, newer CLIs can talk to older daemons. We’re also adding feature negotiation so that proper errors are returned if a new client is attempting to use features not supported in an older daemon. This greatly improves interoperability and makes it much simpler to manage Docker installs with different versions from the same machine.