如何升级docker服务器版本?

如何升级docker服务器版本?

我正在学习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

我的docker版本是:

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,这个问题可能会得到解决,但我不知道该怎么做,有什么想法吗?

答案1

您需要升级您的 docker 安装。docker 主页描述了如何安装 docker-ce

严格按照以下步骤操作:删除当前 docker,添加 docker-ce 存储库,添加 pgp 密钥,然后安装 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) \
    stable"
$ 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

更新:将 gpg 密钥处理从 更改apt-key add为新的、建议的密钥存储方式/usr/share/keyrings/

相关内容