There may be the case that you connect the remote docker service with the API version older than your local one.

Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.22)

Since docker 1.10, we can use the environment variable  DOCKER_API_VERSION to override the API version like this:

export DOCKER_API_VERSION=1.22