Error: Error response from daemon: client version 1.4x is too new. Maximum supported API version is 1.xx
If you recently updated your system or tried to connect to a remote Docker server, you might have hit a wall with the error message: “client is newer than server (client API version: 1.XX, server API version: 1.XX).”
Itโs one of the most frustrating moments in a developer’s day. Everything was working fine yesterday, but suddenly, your Docker commands are failing. You didn’t touch the server config, so what happened?
Table of Contents
In this guide, we will break down exactly why this mismatch occurs, the quickest ways to bypass it immediately, and the permanent solutions to ensure your Docker environment is stable.
What Does This Error Mean?
Before we jump into the fixes, it is crucial to understand the architecture of Docker. Unlike many CLI tools that run as a single binary, Docker operates on a Client-Server architecture.
The Docker Architecture Explained
When you type docker run or docker build in your terminal, you aren’t actually doing the heavy lifting there. You are using the Docker Client (the CLI).
- The Client: This is your command-line interface (CLI). It accepts your commands and translates them into API requests.
- The Daemon (Server): This is the background process (
dockerd) that actually manages containers, images, networks, and volumes. - The API: The Client and the Daemon communicate via a REST API.
The error “client API version is larger than daemon API version” occurs when your Client (CLI) has been updated to a newer version that speaks a “language” (API version) the Daemon (Server) does not yet understand.
Why Did This Happen Suddenly?
This usually happens in two scenarios:
- Automatic Updates: Your local machine (e.g., macOS with Homebrew or Windows) automatically updated the Docker CLI to the latest version, but the Docker Daemon (running on a remote Linux server or a stable VM) is still on an older version.
- Remote Contexts: You are trying to control an older remote server from a brand-new laptop.
The Quick Fix: Using the DOCKER_API_VERSION Variable
If you are stuck in a deployment or need to run a container right now, you don’t have time to upgrade servers. The fastest solution is to tell your modern Client to “speak” the older language of the Server.
You can force the Docker Client to use a specific API version using an environment variable.
Step 1: Find the Server’s API Version
First, you need to know exactly which version the server supports. Run this command:
Bash
docker version
If the command fails entirely, try running it on the server directly. Look for the line under Server that says API version. Let’s assume the server supports 1.40.
Step 2: Set the Environment Variable
For Linux and macOS (Terminal)
Run the following command in your terminal session:
Bash
export DOCKER_API_VERSION=1.40
Now, try your Docker command again. It should work instantly.
Pro Tip: To make this permanent for your current shell, add that line to your
.bashrcor.zshrcfile.
For Windows (PowerShell)
If you are using PowerShell, the syntax is slightly different:
PowerShell
$env:DOCKER_API_VERSION="1.40"
For Windows (Command Prompt)
DOS
set DOCKER_API_VERSION=1.40
Why This is a “Band-Aid” Solution
While this gets you back to work immediately, it restricts your Client from using new features available in newer API versions. It is a compatibility mode, not a permanent fix for infrastructure drift.
The Permanent Fix: Aligning Your Versions
To solve this problem for good, you need to synchronize the versions of your Client and Daemon. You have two main paths: Upgrade the Server (Recommended) or Downgrade the Client.
Method 1: Upgrading the Docker Daemon (Recommended)
The best approach is to update the server so it supports the latest API. This ensures you have the latest security patches and features.
On Ubuntu/Debian Servers:
- Update your package index:Bash
sudo apt-get update - Install the latest Docker Engine:Bash
sudo apt-get install docker-ce docker-ce-cli containerd.io - Restart Docker:Bash
sudo systemctl restart docker
On CentOS/RHEL:
Bash
sudo yum update
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
Once updated, the Daemon will support the newer API versions, and your Client will connect without issues.
Method 2: Downgrading the Docker Client
If you cannot touch the server (e.g., it’s a legacy production server or managed by another team), you must downgrade your local CLI.
Using Homebrew (macOS/Linux):
Downgrading via Homebrew can be tricky as they don’t maintain old versions easily. A better bet is to overwrite the binary.
- Find the specific version you need (e.g., Docker 19.03).
- Download the static binary from the Docker download archives.
- Replace your local binary:Bash
# Example for Linux wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.9.tgz tar xzvf docker-19.03.9.tgz sudo cp docker/docker /usr/local/bin/
Common Scenarios and Use Cases
Understanding where this error pops up helps you prevent it. Here are the most common real-world scenarios.
1. CI/CD Pipelines (Jenkins, GitLab CI, GitHub Actions)
Scenario: Your CI pipeline suddenly fails with “client API version is larger…”
Cause: The CI runner (the ephemeral machine running the build) updated its Docker CLI tool, but the Docker Daemon on the host machine is older.
Fix: Define the DOCKER_API_VERSION environment variable in your pipeline configuration (e.g., .gitlab-ci.yml or Jenkinsfile).
Example GitLab CI Fix:
YAML
variables:
DOCKER_API_VERSION: "1.40"
2. Managing Multiple Remote Contexts
Scenario: You manage a fleet of servers. Some are new (Ubuntu 22.04), and some are old (Ubuntu 16.04).
Cause: Your local CLI is bleeding edge, but the legacy servers are years behind.
Fix: Use Docker Contexts. You can inspect contexts, but often the environment variable switch is faster for quick checks.
3. Kubernetes and Minikube
Sometimes, the Docker CLI bundled with Kubernetes tools or Minikube might differ from your system-wide Docker. Ensure your minikube docker-env is pointing to the right environment.
Deep Dive: Docker API Compatibility Matrix
To avoid guessing, it helps to know which Docker Engine version corresponds to which API version.
| Docker Engine Version | API Version |
| 24.0.x | 1.43 |
| 23.0.x | 1.42 |
| 20.10.x | 1.41 |
| 19.03.x | 1.40 |
| 18.09.x | 1.39 |
| 18.06.x | 1.38 |
| 17.12.x | 1.35 |
Note: The API version usually increases with every major Docker release.
You can also read detailed documentation on the official Docker API version history page.
Troubleshooting Checklist
If you are still facing issues, run through this checklist:
- Check Local Version: Run
docker versionand look at theClientblock. - Check Server Version: SSH into the server and run
docker versionto see theServerblock. - Check Env Vars: Run
env | grep DOCKERto see if a stray environment variable is overriding your settings. - Sudo Rights: sometimes running
sudo docker versionreveals that the root user is using a different binary than your local user.
Frequently Asked Questions (FAQs)
Here are the most common questions related to Docker API version mismatches.
Can I just ignore this error?
No. Docker will refuse to execute commands if the version mismatch is incompatible. You must either downgrade the client request (using the environment variable) or upgrade the server.
Will setting DOCKER_API_VERSION break anything?
It won’t “break” anything, but it might prevent you from using newer Docker features (like BuildKit improvements) that rely on the newer API. It limits the capabilities of your client to whatever that API version supported.
How do I find the maximum API version my server supports?
Log in to the server and run docker version. Look for the “API version” line under the “Server” section.
Why doesn’t Docker handle backward compatibility automatically?
Docker is generally backward compatible (an old client can talk to a new server). The issue arises when a new client tries to talk to an old server. The new client might try to send commands or flags the old server doesn’t know exists.
Does this affect Docker Compose?
Yes. If Docker Compose uses the underlying Docker CLI to communicate with the daemon, it will encounter the same error. You can often fix this by setting the same environment variable before running docker-compose up.
I updated Docker Desktop on Mac/Windows, why is the Daemon still old?
If you are connecting to a remote context (e.g., a Linux VM), updating Docker Desktop only updates your local tools. It does not touch the remote server.
How do I check which API version I am currently forcing?
Run echo $DOCKER_API_VERSION in your terminal. If it returns a value, that is the version you are forcing. If it is empty, you are using the default (highest available) version.
Is this error related to “client version 1.xx is too old”?
That is the opposite error. That happens when your Client is ancient and the Server has deprecated the old API. In that case, you must upgrade your Client.
Can I run two versions of Docker Client on the same machine?
Yes, you can download static binaries of different Docker versions and rename them (e.g., docker-19 and docker-24), placing them in your PATH.
How do I fix this in Jenkins?
In your Jenkins pipeline script, wrap your docker commands in a withEnv block:
GroovywithEnv(['DOCKER_API_VERSION=1.40']) {
sh 'docker run ...'
}
What is the safest API version to use?
There is no single “safest” version. However, version 1.40 (associated with Docker 19.03) is a very common baseline that works on most moderately recent systems.
Does this affect Kubernetes?
It can if you are using kubectl to fetch logs or execute commands in a container, but typically this is a Docker-specific API issue. It mostly affects users manually interfacing with the Docker socket.
Conclusion
The “client API version is larger than daemon API version” error is essentially a communication breakdown between your CLI tool and the background service managing your containers.
While it can stop your workflow dead in its tracks, the solutions are straightforward:
- Immediate Fix: Set
export DOCKER_API_VERSION=1.XXto match your server. - Best Practice: Plan a maintenance window to upgrade your Docker Daemons to the latest supported version.
By understanding the client-server nature of Docker, you can manage these upgrades proactively rather than reacting to errors.
Check your current local version right now by running docker version. If you manage remote servers, verify their versions today to prevent this surprise tomorrow!
For further reading, you may check out the Official Docker Architecture Overview.