Connect with ssh to docker daemon on Windows

こ雲淡風輕ζ 提交于 2020-04-08 05:39:10

问题


I installed Docker Desktop for Windows on Windows 10 with https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows. It not uses VirtualBox and default VM to host docker.

I am able to run containers but how I connect to a docker with ssh?

docker-machine ls does not show my docker host.

Tried to connect to docker@10.0.75.1 but it requires password. And tcuser that used for boot2docker VM not matching:

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


回答1:


Run this:

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.

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




回答2:


As far as I know you can't connect to the docker VM using SSH and you cannot connect to the console/terminal using Hyper-V Manager either. https://forums.docker.com/t/how-can-i-ssh-into-the-betas-mobylinuxvm/10991/17



来源:https://stackoverflow.com/questions/44370059/connect-with-ssh-to-docker-daemon-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!