docker-compose -“未找到分发且应用程序需要分发”

问题描述 投票:0回答:1

在我的 Ubuntu 虚拟服务器上,我最近在运行 docker-compose 时遇到错误。奇怪的是,几个月前它就起作用了。

root@myserver:~/npm# docker-compose up -d
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 582, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 899, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 790, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (docker-compose 1.29.2 (/usr/lib/python3.9/site-packages), Requirement.parse('docker-compose==1.17.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3257, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3240, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3269, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 597, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 785, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docker-compose==1.17.1' distribution was not found and is required by the application

据我所知,我安装的 docker-compose 版本是 1.17.1-2

我绝对不是专家,所以任何帮助将不胜感激!

ubuntu docker-compose
1个回答
0
投票

“docker-compose”是一个单独的实用程序,我怀疑它与您安装的 docker 不同步。

AI 建议运行与使用 docker cli 命令相同的命令。

例如而不是跑步:

docker-compose up

运行:

docker compose up
© www.soinside.com 2019 - 2024. All rights reserved.