简体   繁体   English

ubuntu 上的虚拟盒中的 Docker

[英]Docker in virtualbox on ubuntu

I have win 10 as an operating system, I have installed virtualbox where ubuntu is installed and docker with its containers is installed in ubuntu.我有win 10作为操作系统,我安装了virtualbox,其中安装了ubuntu,docker及其容器安装在ubuntu中。 I set the virtualbox network in bridge, and in DHCP I assigned an IP that I can easily reach from the win 10 chrome browser (outside of virtualbox).我在bridge中设置了virtualbox网络,并在DHCP中分配了一个IP,我可以从win 10 chrome浏览器(在virtualbox之外)轻松访问它。 The problem is that I cannot access the docker container where a webserver runs in loalhost, I can access it without problems inside the virtualbox and externally I can access another webserver in the virtualbox but not the webserver docker?问题是我无法访问在 loalhost 中运行网络服务器的 docker 容器,我可以在 virtualbox 内毫无问题地访问它,并且在外部我可以访问 virtualbox 中的另一个网络服务器,但不能访问网络服务器 docker? How could I solve it?我该如何解决? thanks for any replies!感谢您的回复!

It seems that I have solved, I describe here the simple solution that I have adopted.看来我已经解决了,我在这里描述一下我采用的简单解决方案。 the VM has an IP assigned in dhcp by the bridge network. VM 有一个由桥接网络在 dhcp 中分配的 IP。 (this setting has remained for a second webserver to work) In virtualbox settings I simply enabled a second NAT network from "network-settings" and in "advanced-port forwarding" I only added host port on 80 and guest port on 80, because docker run establishes its ip and its port reachable only on local host (in this case reachable only inside virtualbox). (此设置保留为第二个网络服务器工作)在 virtualbox 设置中,我只是从“网络设置”中启用了第二个 NAT 网络,而在“高级端口转发”中,我只在 80 上添加了主机端口,在 80 上添加了访客端口,因为docker 运行建立了它的 ip 和它的端口只能在本地主机上访问(在这种情况下只能在 virtualbox 内访问)。

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

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