3
votes

When executing DOCKER_API_VERSION=1.35 docker-compose --verbose up I'm getting:

-d compose.config.config.find: Using configuration files: ./docker-compose.yml docker.utils.config.find_config_file: Trying paths: ['/home/vivo/.docker/config.json', '/home/vivo/.dockercfg'] docker.utils.config.find_config_file: No config file found docker.utils.config.find_config_file: Trying paths: ['/home/vivo/.docker/config.json', '/home/vivo/.dockercfg'] docker.utils.config.find_config_file: No config file found urllib3.connectionpool._make_request: http://localhost:None "GET /v2.25/version HTTP/1.1" 400 84 Traceback (most recent call last):
File "site-packages/docker/api/client.py", line 261, in _raise_for_status File "site-packages/requests/models.py", line 940, in raise_for_status requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v2.25/version

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "bin/docker-compose", line 6, in File "compose/cli/main.py", line 71, in main File j

"compose/cli/main.py", line 124, in perform_command File "compose/cli/command.py", line 42, in project_from_options File "compose/cli/command.py", line 123, in get_project File "compose/cli/command.py", line 97, in get_client File "site-packages/docker/api/daemon.py", line 181, in version File "site-packages/docker/api/client.py", line 267, in _result File "site-packages/docker/api/client.py", line 263, in _raise_for_status
File "site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception docker.errors.APIError: 400 Client Error: Bad Request ("client version 2.25 is too new. Maximum supported API version is 1.38")

My docker version:

docker-tutorial % docker version Client: Version:
18.06.3-ce API version: 1.27 Go version: go1.10.3 Git commit: d7080c1 Built: Wed Feb 20 02:27:13 2019 OS/Arch: linux/amd64 Experimental: false

Server: Engine: Version: 18.06.3-ce API version:
1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: d7080c1 Built: Wed Feb 20 02:25:38 2019 OS/Arch:
linux/amd64 Experimental: false

My docker-compose version:

docker-tutorial % docker-compose version docker-compose version 1.24.1, build 4667896b docker-py version: 3.7.3 CPython version: 3.6.8 OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018

And my docker-compose.yml:

version: '2.3'

services:
    app:
        image: php:7.2-apache
        volumes:
            - .:/var/www/html
        ports:
            - 8000:80
3

3 Answers

0
votes

Based on this documentation I think you want to set COMPOSE_API_VERSION:

COMPOSE_API_VERSION

The Docker API only supports requests from clients which report a specific version. If you receive a "client and server don't have same version error" using docker-compose, you can workaround this error by setting this environment variable. Set the version value to match the server version.

0
votes

Please refer here
Issue seems to have been fixed in Docker Version 18.09 onwards. Worth upgrading. If you do not want your containers to get affected while Docker version upgrade, enable live-restore on your daemon.json and do a systemctl reload daemon. After that perform the upgrade.

0
votes

Running on linux Based Distributions sometimes this happens when there is a update in the distribution after apt update ,

you can just do a restart as service , sometimes this solves the problem. sudo service docker restart ,

In other case it might be ISO Cache issue which can be resolved using docker-machine upgrade dev/YourMachineName