从swarm管理器运行docker exec [英] run docker exec from swarm manager

查看:179
本文介绍了从swarm管理器运行docker exec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个工作程序节点:worker1和worker2和一个群集管理器。我仅在工作程序节点中运行所有服务。我需要从manager docker exec运行,以访问在worker节点中创建的一些容器,但我不断得到该服务未被识别的信息。我知道我可以在任何一个工作节点上运行docker exec,并且工作正常,但是我不想找到服务在哪个节点上运行,然后SSH到指定的节点以运行docker exec命令。

I have two worker nodes: worker1 and worker2 and one swarm manager. I'm running all the services in the worker nodes only. I need to run from the manager docker exec to access some of the containers created in the worker nodes but I keep getting that the service is not recognized. I know I can run docker exec in any of the worker nodes and it works fine but I dont want to have to find on which node the service is running and then ssh to the designated node to run docker exec command. Is there a way to do so in swarm or not?

推荐答案

Swarm模式当前没有办法在exec上运行exec。正在运行的任务。您需要找到容器并在主机上运行exec。您可以将工作程序配置为具有侦听的受TLS保护的端口,这将为您提供远程访问权限(请参阅码头工人指南)。然后,您可以通过检查 docker服务ps $ service_name 的输出来查找服务中每个任务的节点。

Swarm mode does not currently have a way to run an exec on a running task. You need to find the container and run the exec on the host. You can configure the workers to have a TLS protected port they listen on, which would give you remote access (see docker's guide). And you can lookup the node for each task in a service by checking the output of a docker service ps $service_name.

这篇关于从swarm管理器运行docker exec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆