在Windows上使用ssh连接到docker守护程序

问题描述 投票:6回答:2

我使用https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows在Windows 10上安装了适用于Windows的Docker Desktop。它不使用VirtualBox和默认VM来托管docker。

我能够运行容器,但我如何使用ssh连接到docker?

docker-machine ls没有显示我的码头主机。

试图连接到[email protected]但它需要密码。用于boot2docker VM的tcuser不匹配:

ssh [email protected]无法创建目录'/home/stan/.ssh'。主机'10 .0.75.1(10.0.75.1)'的真实性无法确定。 RSA密钥指纹是....你确定要继续连接(是/否)?是无法将主机添加到已知主机列表(/home/stan/.ssh/known_hosts)。 [email protected]的密码:写入失败:由对等方重置连接

docker docker-machine docker-for-windows docker-desktop
2个回答
2
投票

据我所知,您无法使用SSH连接到docker VM,也无法使用Hyper-V Manager连接到控制台/终端。 https://forums.docker.com/t/how-can-i-ssh-into-the-betas-mobylinuxvm/10991/17


7
投票

运行这个:

docker run -it --rm --privileged --pid=host justincormack/nsenter1

只需从CLI运行它,它就会将您放入具有Moby VM完全权限的容器中。仅适用于Moby Linux VM(不适用于Windows Containers)。请注意,这也适用于Docker for Mac。

参考:https://www.bretfisher.com/getting-a-shell-in-the-docker-for-windows-vm/

© www.soinside.com 2019 - 2024. All rights reserved.