简体   繁体   中英

Docker for Windows 10 how to access host machine

I am using docker for windows 10 for development. Before I used Docker Toolbox on windows 8. I am used to "tune" the host virtual machine in this case the MobyLinuxVM .

When I try to connect in hyper-v manager i get error cannot connect . When I try to docker-machine ls I get no docker machines. How can I possibly access the underlying machine on docker for windows 10?

Problems I want to solve are (aka why I want to connect):

  • Ubuntu apt-get doesnt work for me (I am behind proxy) get errors like E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/source/Sources Cannot initiate the connection to 3128:80 (0.0.12.56). - connect (22: Invalid argument) E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/source/Sources Cannot initiate the connection to 3128:80 (0.0.12.56). - connect (22: Invalid argument) . On other hand Centos yum , curl ,... works. http_proxy variables are set.

  • I want to turn off swap on the host.

update Solved problem with apt-get by changin configuration of http proxy in docker settings from 1.2.3.4:1234 to http://1.2.3.4:1234/ .

update 2 Worked around the problem by modifying /etc/init.d/automount in host and added swapoff -a .

I was able to access host MobyLinuxVM through container run with various privieleges.

First I ran container like that (note the double slash when mounting root filesystem. Single slash didnt work for me in powershell )

$ docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v //:/host alpine sh

after that when I got into container I just did $ chroot /host

and then I could access all i needed. /etc/fstab or swapoff -a .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM