2017-06-13 87 views
1

在部署于泊坞窗访问应用程序 - MAC bookPro Mac OSx 10.11.6MAC |从另一个应用程序VirtualBox虚拟机

泊坞窗 - 泊坞窗的Mac Docker version 17.03.1-ce, build c6d412e

VirtualBox的 - Version 5.1.22 r115126 (Qt5.6.2)

我有我的AEM( CMS)在Virtual Box上的图像上运行,使用Vagrant + Chef进行配置。我们明确地将IP分配给框 - 192.168.x.x

我们已经介绍了我们希望使用Docker部署的微服务(Spring boot + MySQL)。 在我的本地(MAC)上,我成功地获得了Microservice的启动和运行以及两个docker实例(Microservice,MySQL)的成功连接。微服务公开了我需要从Virtual Box中运行的AEM调用的某些端点。这是我无法做到的事情,我的virtualbox实例无法连接到docker托管的应用程序(docker机器的IP在我的virtualbox中无法访问)

我使用docker compose来让我的docker实例工作 -

这里是我的docker-compose.yml

version: "3" 

services: 
    db: 
    #build: 
    # context: ./registration-database 
    image: mysql 
    container_name: afs-mysql 
    #network_mode: "bridge" 
    # set default mysql root password, change as needed 
    environment: 
     MYSQL_DATABASE: afs_service 
     MYSQL_ROOT_PASSWORD: root 
    # Expose port 3306 to host. Not for the application but 
    # handy to inspect the database from the host machine. 
    ports: 
     - "3309:3306" 
    restart: always 

    webserver: 
    container_name: afs-microservice 
    #network_mode: "bridge" 
    depends_on: 
     - db 
    links: 
     - db 
    # build: 
    # context: ./registration-webserver 
    image: afs-service 
    # mount point for application in tomcat 
    #volumes: 
    # - ./app/target/UserSignup:/usr/local/tomcat/webapps/UserSignup 
    environment: 
     DATABASE_HOST: db 
     DATABASE_USER: root 
     DATABASE_PASSWORD: root 
     DATABASE_NAME: afs_service 
     DATABASE_PORT: 3306 
    # open ports for tomcat and remote debugging 
    ports: 
     - "8080:8080" 
     - "8089:8089" 
    restart: always 

什么额外需要做的事情,这样我可以从VirtualBox的访问泊坞窗展示的应用。

+0

如果您使用新的docker-for-mac,而不是**涉及docker-machine,那么您会在主机界面中看到暴露的端口,所以从流浪机器认为) – Robert

回答

0

通过连接到Mac的IP地址,您可以到达任何docker-for-mac发布的端口。

既然你提到你想从一个VirtualBox虚拟机内部访问你的Mac,你有几种选择:

  • (VirtualBox主机模式网络) - 只需连接到Mac上的IP地址virtualbox主机专用网络。通常这将与虚拟机VM的IP匹配,但以.1结束。例如,如果连接到主机专用网络的virtualbox以太网接口的IP地址为192.168.30.100,则该主机专用网络上的MAC地址几乎肯定是192.168.30.1。你应该能够在你的mac上看到ifconfig的输出。
  • (virtualbox NAT模式联网) - 连接到虚拟机VM所看到的网关的IP地址。 Virtualbox的主机模式网络将转发这些连接到您的mac的127.0.0.1
  • 连接到您的mac的en0 ip地址。该IP仍可从您的virtualbox VM中访问。
+0

(virtualbox NAT模式网络) - 连接到您的virtualbox虚拟机看到的网关的IP地址。 Virtualbox的主机模式网络将转发这些连接到您的Mac的127.0.0.1 为我工作。 –

相关问题