使用 ssh 连接到 Windows 上的 docker 守护程序
Connect with ssh to docker daemon on Windows
我在 Windows 10 和 https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows 上为 Windows 安装了 Docker 桌面。它不使用 VirtualBox 和默认 VM 来托管 docker.
我可以 运行 容器,但我如何使用 ssh 连接到 docker?
docker-machine ls
没有显示我的 docker 主机。
已尝试连接到 docker@10.0.75.1,但需要密码。并且用于 boot2docker VM 的 tcuser
不匹配:
ssh docker@10.0.75.1 Could not create directory '/home/stan/.ssh'. The
authenticity of host '10.0.75.1 (10.0.75.1)' can't be established. RSA
key fingerprint is .... Are you sure you want to continue connecting
(yes/no)? yes Failed to add the host to the list of known hosts
(/home/stan/.ssh/known_hosts). docker@10.0.75.1's password: Write
failed: Connection reset by peer
据我所知,您无法使用 SSH 连接到 docker 虚拟机,也无法使用 Hyper-V 管理器连接到 console/terminal。 https://forums.docker.com/t/how-can-i-ssh-into-the-betas-mobylinuxvm/10991/17
运行 这个:
docker run -it --rm --privileged --pid=host justincormack/nsenter1
Just run this from your CLI and it'll drop you in a container with
full permissions on the Moby VM. Only works for Moby Linux VM (doesn't
work for Windows Containers). Note this also works on Docker for Mac.
参考:
https://www.bretfisher.com/getting-a-shell-in-the-docker-for-windows-vm/
我在 Windows 10 和 https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows 上为 Windows 安装了 Docker 桌面。它不使用 VirtualBox 和默认 VM 来托管 docker.
我可以 运行 容器,但我如何使用 ssh 连接到 docker?
docker-machine ls
没有显示我的 docker 主机。
已尝试连接到 docker@10.0.75.1,但需要密码。并且用于 boot2docker VM 的 tcuser
不匹配:
ssh docker@10.0.75.1 Could not create directory '/home/stan/.ssh'. The authenticity of host '10.0.75.1 (10.0.75.1)' can't be established. RSA key fingerprint is .... Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/home/stan/.ssh/known_hosts). docker@10.0.75.1's password: Write failed: Connection reset by peer
据我所知,您无法使用 SSH 连接到 docker 虚拟机,也无法使用 Hyper-V 管理器连接到 console/terminal。 https://forums.docker.com/t/how-can-i-ssh-into-the-betas-mobylinuxvm/10991/17
运行 这个:
docker run -it --rm --privileged --pid=host justincormack/nsenter1
Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.
参考: https://www.bretfisher.com/getting-a-shell-in-the-docker-for-windows-vm/