I am learning docker-compose according to this.

After I running docker-compose up, it says

/tmp/_MEIepUvmP/docker/api/client.py:163: UserWarning: The minimum API version supported is 1.21, but you are using version 1.18. It is recommended you either upgrade Docker Engine or use an older version of Docker SDK for Python.
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 124, in perform_command
  File "compose/cli/main.py", line 1001, in up
  File "compose/cli/main.py", line 997, in up
  File "compose/project.py", line 451, in up
  File "compose/project.py", line 508, in initialize
  File "compose/network.py", line 262, in initialize
  File "compose/network.py", line 63, in ensure
  File "compose/network.py", line 96, in inspect
  File "site-packages/docker/utils/decorators.py", line 31, in wrapper
docker.errors.InvalidVersion: inspect_network is not available for version < 1.21
Failed to execute script docker-compose

My docker version is:

Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.2.1
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.2.1
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

Then, I try export COMPOSE_API_VERSION=1.21, it says

ERROR: client and server don't have same version (client : 1.21, server: 1.18)

I guess this problem may be solved if I upgrade the server version to 1.21, but I don't know how to do this, any idea ?


You need to upgrade your docker installation. The docker homepage describes how to install docker-ce.

Follow these steps to the letter: remove current docker, add docker-ce repository, add pgp key then install docker-ce

$ sudo apt-get remove --purge docker docker-engine docker.io
$ sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
    | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ sudo apt-get update
$ sudo apt-get install docker-ce

Update: Changed gpg key handling from apt-key add to the new, recommended storing of the key in /usr/share/keyrings/

  • 1
    It should be noted, that since this answer was written, it is no longer recommended to use apt-key add for handling repo keys. See this question. Jun 10 at 11:29
  • 1
    I did not now that Debian hast these wiki.debian.org/DebianRepository/UseThirdParty guideline... I do however miss the apt-key add already Jun 10 at 13:19
  • Useful link - thanks. If you follow the link I provided, I actually made a script that makes installing keys somewhat easier. But you still have to edit the sources.list file manually. Jun 10 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.