我正在根据this学习docker-compose 。
我跑步后docker-compose up
,它说
/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
我的码头工人版本是:
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
然后,我尝试export COMPOSE_API_VERSION=1.21
,它说
ERROR: client and server don't have same version (client : 1.21, server: 1.18)
我想如果我将服务器版本升级到 1.21,这个问题可能会解决,但我不知道该怎么做,有什么想法吗?
您需要升级 docker 安装。docker 主页描述了如何安装 docker-ce。
请按照以下步骤操作:删除当前 docker,添加 docker-ce 存储库,添加 pgp 密钥,然后安装 docker-ce
更新:将 gpg 密钥处理从更改
apt-key add
为新的,建议将密钥存储在/usr/share/keyrings/