【发布时间】:2023-04-24 15:39:01
【问题描述】:
我使用以下手册在我的机器上安装 swarm 没有使用 docker-machine: https://docs.docker.com/swarm/install-manual/ 现在我想使用 docker-compose 创建容器化应用程序集群。 但无法让 docker-compose 到达 swarm。
例如: 以下命令返回结果:
docker -H :4000 ps
但是,docker-compose 不会:
docker-compose -H my.IP.address:4000 ps
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose/cli/main.py", line 61, in main
File "compose/cli/main.py", line 113, in perform_command
File "contextlib.py", line 35, in __exit__
File "compose/cli/errors.py", line 56, in handle_connection_errors
TypeError: log_timeout_error() takes exactly 1 argument (0 given)
docker-compose returned -1
docker-compose -H :4000 ps
也不会到达 swarm
有人知道我做错了什么吗?
有一些设置环境变量的提示:
DOCKER_HOST
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY
但是如何获取 DOCKER_CERT_PATH
【问题讨论】:
-
请编辑您的问题以回答以下问题:机器是本地的还是云基础设施上的?你设置证书了吗?您是要从 swarm 主节点还是从其他地方运行这些命令?您是否已经配置了发现后端?
-
您好,机器是本地的,但它们是使用 KVM 虚拟创建的。他们在同一个网络中。命令从 swarm 主节点执行。为了发现,我使用了上述手册中描述的领事。我还没有设置证书,会不会有问题?
-
ok 尝试使用
-H localhost:4000
或将DOCKER_HOST
设置为localhost:4000
也一样 -
不幸的是,这没有帮助:
[root@uxtest14 es-cluster]# docker-compose -H localhost:4000 ps ERROR: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8"> <title>ERROR: The requested URL could not be retrieved</title> .... .... <p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:4000/v1.21/containers/json?">http://localhost:4000/v1.21/containers/json?</a></p>
标签: docker docker-compose docker-swarm