如何从主机外部(同一网络)连接到docker容器[OSX 10.11] [英] How to connect to a docker container from outside the host (same network) [OSX 10.11]

查看:196
本文介绍了如何从主机外部(同一网络)连接到docker容器[OSX 10.11]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置:




  • 计算机A - 这是Docker-Machine默认运行在
    VirtualBox下的位置。 default运行一个名为Odoo的容器。 default
    是使用




    The Setup:

    • Computer A - This is where the Docker-Machine "default" runs under VirtualBox. "default" is running a container called "Odoo". "default" was created using Docker's installation process. "Odoo" was created using Odoo's installation process.
    • Computer B - This is a computer on the same Local Area Network (LAN) as Computer A.
    • Router - This connects Computer A and Computer B together on the LAN.

    The Software:

    • Computer A - OSX 10.11.3 / VirtualBox 5.0.18 / Docker 1.11
    • Computer B - Windows 7 / Firefox
    • Router - ASUSWRT

    The Problem:

    • Odoo is accessible on Computer A using "default's" IP address plus Odoo's associated port number. An example of the address is: 192.168.99.101:8069.
    • Odoo is NOT accessible on Computer B using "default's" IP address plus Odoo's associated port number.

    The Question:

    • How is the VirtualBox environment configured such that Computer B can access Odoo on the LAN?

    解决方案

    That 192.168.99.101 is Docker host’s IP address internal to Computer A. You only need to config port forwarding from defaut's port 8069 to host machine' port 8069. Then odoo will be accessible by computer B with computer A's ip address(ex: 10.0.1.22) plus port 8069. Since both computers are within the same network, you shouldn't need to change settings of your router(except firewall settings, if there is any)

    10.0.1.22:8069
    

    Port forwarding need to be set in virtulbox settings

    这篇关于如何从主机外部(同一网络)连接到docker容器[OSX 10.11]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆