繁体   English   中英

Docker for Windows 10如何访问主机

[英]Docker for Windows 10 how to access host machine

我正在使用docker for windows 10进行开发。 在Windows 8上使用Docker Toolbox之前,我习惯于“调整”主机虚拟机,在这种情况下是MobyLinuxVM

当我尝试在hyper-v管理器中connect ,我得到错误cannot connect 当我尝试docker-machine ls我没有停靠机器。 如何在windows 10上使用docker访问底层机器?

我想解决的问题是(也就是我想连接的原因):

  • Ubuntu apt-get对我不起作用(我在代理之后)得到像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) 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) 另一方面Centos yumcurl ,...有效。 http_proxy变量已设置。

  • 我想关闭主机上的swap

更新通过在1.2.3.4:1234http://1.2.3.4:1234/ 1.2.3.4:1234设置中使用http proxy 1.2.3.4:1234配置来解决apt-get问题。

更新2通过修改主机中的/etc/init.d/automount并添加了swapoff -a来解决此问题。

我能够访问主机MobyLinuxVM通过容器运行在各种privieleges。

首先我运行这样的容器(注意安装根文件系统时的双斜杠 。在powershell单斜杠对我powershell

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

在那之后,当我进入容器时,我只是做了$ chroot /host

然后我可以访问我需要的所有内容。 /etc/fstabswapoff -a

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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