将Docker上下文使用到Mac

发布于 2025-02-12 23:06:12 字数 1159 浏览 1 评论 0 原文

我一直在尝试创建一个上下文,将一些容器从我的主Mac部署到另一个容器,但我遇到了一个奇怪的错误。

因此,我有两个Mac,一个iMac(2013年底)(此处称为Enterprise)和一个MacBook Pro(2015年中)(此处称为Defiant)。 Defiant是我的主要计算机,我想将我的容器部署到企业中,以便不超载反抗内存。我一直在与Docker上下文合作以实现这一目标。目前,我有运行Docker v20.10.16的企业,并且运行v20.10.16。

我已经在Defiant上创建了上下文,并且运行 Docker上下文后,请使用Enterprise ,当我运行 Docker Container LS 时,我会收到以下错误:

error during connect: Get "http://docker.example.com/v1.24/containers/json": command [ssh -l rafaelguerra -- Enterprise.local docker system dial-stdio] has exited with exit status 127, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=zsh:1: command not found: docker

有人知道工作?

谢谢

更新:

刚刚登录企业并运行 echo $ path 返回/usr/local/bin:/usr/bin:/usr/bin:/usr/sbin: /sbin 但是,当我运行 ssh [email  procectioned] /usr/bin:/bin:/usr/sbin:/sbin

我没有任何线索,原因是这样。

I had been trying to create a context to deploy a few containers from my main Mac to another another but I have been getting a weird error.

So, I have two Macs, one iMac (Late 2013) (here will be called Enterprise) and one Macbook Pro (Mid 2015) (here will be called Defiant). Defiant is my main computer and I want to deploy my container to Enterprise in order to not overload Defiant memory. I have been working with docker context to achieve that. Currently, I have Enterprise running Docker v20.10.16 and Defiant running v20.10.16.

I have created the context on Defiant and after I run the docker context use enterprise and when I run docker container ls I get the following error:

error during connect: Get "http://docker.example.com/v1.24/containers/json": command [ssh -l rafaelguerra -- Enterprise.local docker system dial-stdio] has exited with exit status 127, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=zsh:1: command not found: docker

Does anyone know how to make it work?

Thanks

UPDATE:

Weird thing I just found out, when logged into Enterprise and run echo $PATH returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin however when I run ssh [email protected] 'echo $PATH' I got the following /usr/bin:/bin:/usr/sbin:/sbin

I don't have a clue for a reason for this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尽揽少女心 2025-02-19 23:06:12

我发现问题的原因,所有命令docker运行均在SSH中运行,而不是永久的SSH会话。因此,当命令在SSH内运行时,ZSH不会加载正确的路径。因此,我唯一需要做的就是在〜/.zshenv文件的内部设置正确的路径,现在一切都在起作用。

I found the reason for the problem, all commands docker run are run within ssh not with a permanent ssh session. So, zsh does not load the correct PATH when the command is run within the ssh. Therefore, the only thing I need to do was setting the correct PATH inside of the ~/.zshenv file and everything is working now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文