How to SSH into the Docker VM (MobyLinuxVM) on Windows

转自 https://blog.jongallant.com/2017/11/ssh-into-docker-vm-windows/

On Windows, Docker runs in a VM called MobyLinuxVM, but you cannot login to that VM via Hyper-V Manager. We aren’t technically going to SSH into the VM, we’ll create a container that has full root access and then access the file system from there.

  1. Get container with access to Docker Daemon
  2. Run container with full root access
  3. Switch to host file system

Open a Command prompt and execute the following:

docker run --privileged -it -v /var/run/docker.sock:/var/run/docker.sock juvenile / ubuntu docker client 
docker run --net = host --ipc = host --uts = host --pid = host -it --security-opt = seccomp = unconfined --privileged --rm -v /:/ host alpine / bin / sh
chroot / host

You can then execute whatever commands you need to execute.

This code was found on the Docker forums here, thanks to Manuel Patrone for posting it.

猜你喜欢

转载自blog.csdn.net/u013114078/article/details/86538119