This error occurs when your Docker client uses a newer API version than the Docker daemon supports. The solution involves either upgrading the daemon or setting the DOCKER_API_VERSION environment variable.
The Docker CLI and Docker Engine (daemon) communicate through a versioned HTTP API. When you run a Docker command, the client attempts to use a specific API version to talk to the daemon. This error appears when the client's API version is higher than what the daemon can handle. This situation commonly occurs after upgrading the Docker CLI without updating the Docker Engine, when connecting to a remote Docker host running an older version, or when using newer tools (like docker-compose or Traefik) with an older Docker daemon. The API version is tied to specific Docker Engine releases; for example, API v1.44 corresponds to Docker Engine v25.0. Starting with Docker Engine v29.0.0, the minimum supported API version was raised to v1.44, which can cause compatibility issues with older clients or tools that attempt to use very old API versions.
First, identify the version mismatch by checking both client and server API versions:
docker versionThis displays both the Client and Server sections. Look for the "API version" lines:
Client:
Version: 24.0.7
API version: 1.43
Server:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)In this example, the client uses API 1.43 but the server only supports up to 1.41. Note the server's maximum supported version for the next step.
The quickest fix is to tell the client to use an older API version by setting the DOCKER_API_VERSION environment variable:
Linux/macOS (temporary):
export DOCKER_API_VERSION=1.41
docker ps # Should work nowLinux/macOS (permanent):
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
echo 'export DOCKER_API_VERSION=1.41' >> ~/.bashrc
source ~/.bashrcWindows PowerShell (temporary):
$env:DOCKER_API_VERSION="1.41"
docker psWindows PowerShell (permanent):
[Environment]::SetEnvironmentVariable("DOCKER_API_VERSION", "1.41", "User")Replace "1.41" with the maximum API version your server supports.
The best long-term solution is to upgrade your Docker Engine to match or exceed the client version:
Linux (using apt):
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginLinux (using yum/dnf):
sudo yum update docker-ce docker-ce-cli containerd.ioDocker Desktop (Windows/macOS):
1. Open Docker Desktop
2. Click the gear icon (Settings)
3. Go to "Software Updates"
4. Click "Check for updates" and install any available updates
Verify after upgrade:
docker versionBoth Client and Server API versions should now be compatible.
If you cannot upgrade the daemon (e.g., shared infrastructure, production constraints), you can downgrade the CLI:
Using Docker's version-specific packages (Linux):
# List available versions
apt-cache madison docker-ce-cli
# Install specific version
sudo apt-get install docker-ce-cli=5:20.10.21~3-0~ubuntu-jammyUsing Docker binaries directly:
1. Visit https://download.docker.com/linux/static/stable/
2. Download the version matching your daemon
3. Extract and replace the docker binary
Note: Downgrading means losing access to newer features. Consider upgrading the daemon instead when possible.
If the error occurs with docker-compose, set the API version before running compose commands:
export DOCKER_API_VERSION=1.41
docker-compose up -dFor docker-compose v2 (Docker Compose plugin):
export DOCKER_API_VERSION=1.41
docker compose up -dIn docker-compose.yml (for some versions):
You cannot directly set the API version in the compose file, but you can use an .env file:
# .env file in same directory as docker-compose.yml
DOCKER_API_VERSION=1.41Then run:
docker-compose --env-file .env up -dWhen connecting to remote Docker hosts with older versions:
Using DOCKER_HOST with API version:
export DOCKER_HOST=tcp://remote-host:2375
export DOCKER_API_VERSION=1.40
docker psUsing Docker context:
# Create a context for the remote host
docker context create remote-server --docker "host=tcp://remote-host:2375"
# Set API version when using the context
export DOCKER_API_VERSION=1.40
docker --context remote-server psDocker Machine (if applicable):
# Upgrade the Docker Machine instance
docker-machine upgrade <machine-name>
# Or regenerate certificates
docker-machine regenerate-certs <machine-name>For tools like Traefik, Portainer, Watchtower, or Docker SDKs:
Traefik:
Add to your Traefik configuration:
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
# Force a specific API version (check Traefik docs for syntax)Or upgrade Traefik to a version compatible with your Docker daemon.
Python docker SDK:
import docker
client = docker.DockerClient(
base_url='unix://var/run/docker.sock',
version='1.41' # Specify compatible API version
)
# Or use auto-negotiation (recommended)
client = docker.from_env()
client.api.version = '1.41'Go SDK:
cli, err := client.NewClientWithOpts(
client.FromEnv,
client.WithAPIVersionNegotiation(), // Auto-negotiate
)General approach:
Check if the tool supports setting DOCKER_API_VERSION via environment variable or has a configuration option for API version.
In CI/CD environments, set the API version in your pipeline configuration:
GitLab CI (.gitlab-ci.yml):
variables:
DOCKER_API_VERSION: "1.41"
build:
image: docker:latest
services:
- docker:dind
script:
- docker build -t myapp .GitHub Actions:
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_API_VERSION: "1.41"
steps:
- uses: actions/checkout@v4
- name: Build
run: docker build -t myapp .Jenkins:
pipeline {
environment {
DOCKER_API_VERSION = '1.41'
}
stages {
stage('Build') {
steps {
sh 'docker build -t myapp .'
}
}
}
}Best practice: Pin Docker versions in CI to avoid unexpected version mismatches.
Understanding Docker API versioning:
Each Docker Engine release supports a range of API versions. The API is backward-compatible, meaning newer engines support older API versions. The docker version command shows both the current API version and the minimum supported version. API version negotiation was introduced in Docker v1.12.0 (API 1.24).
Docker Engine v29.0.0 breaking change:
Docker Engine v29.0.0 raised the minimum supported API version from v1.12 to v1.44. This means Docker v29+ cannot communicate with clients using API versions older than 1.44. If you're running Docker v29+ and have older tools, they must be updated or you need to downgrade Docker Engine.
API version to Docker version mapping (recent versions):
- API 1.47 = Docker 27.x
- API 1.46 = Docker 26.x
- API 1.45 = Docker 25.x
- API 1.44 = Docker 25.0
- API 1.43 = Docker 24.x
- API 1.42 = Docker 23.x
- API 1.41 = Docker 20.10.x
API version negotiation in SDKs:
Modern Docker SDKs support automatic API version negotiation. This allows the client to automatically downgrade to a compatible API version. In Go: client.WithAPIVersionNegotiation(). In Python: use docker.from_env() which handles negotiation automatically in recent versions.
When DOCKER_API_VERSION won't work:
Setting a lower API version means some newer features won't be available. If your workflow requires features from a newer API version, you must upgrade the daemon. Also, setting DOCKER_API_VERSION doesn't help if the version you set is still higher than what the daemon supports.
Troubleshooting persistent issues:
If the error persists after setting DOCKER_API_VERSION:
1. Ensure the environment variable is exported in the correct shell/context
2. For systemd services, set the variable in the service file's Environment section
3. For containers, pass it via -e DOCKER_API_VERSION=1.41
4. Check if multiple Docker installations exist on the system
Forgetting to unset DOCKER_API_VERSION:
If you set DOCKER_API_VERSION to work with an older host, remember to unset it when connecting to newer hosts, or you may unnecessarily limit the API features available.
image operating system "linux" cannot be used on this platform
How to fix 'image operating system linux cannot be used on this platform' in Docker
manifest unknown: manifest unknown
How to fix 'manifest unknown' in Docker
cannot open '/etc/passwd': Permission denied
How to fix 'cannot open: Permission denied' in Docker
Error response from daemon: failed to create the ipvlan port
How to fix 'failed to create the ipvlan port' in Docker
toomanyrequests: Rate exceeded for anonymous users
How to fix 'Rate exceeded for anonymous users' in Docker Hub