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.
- Get container with access to Docker Daemon
- Run container with full root access
- 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 jongallant/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
view rawssh-info-docker-vm-windows.sh hosted with ❤ by GitHub
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.
摘自:https://blog.jongallant.com/2017/11/ssh-into-docker-vm-windows/