首页 > 解决方案 > Set docker toolbox container to receive information sended to host

问题描述

I have a prototype that sends information to the host machine, and with Docker for Windows, the container grabs that information and everything works fine.

My docker-compose.yml file:

version: '3'

services:
  middleware:
    container_name: middleware
    image: hyperloopupv:middleware
    build: './receta' 
    ports:
    - "5672:5672"
    - "15672:15672"
    - "1338:1338/udp"
    - "5556:5556/udp"

But others from my team are using Docker Toolbox, and Docker Toolbox can not use localhost. I have tried to send the information from the prototype to the IP of the container(192.168.99.100), but the packets are lost.

Is there a way, that my team(using Docker Toolbox) and I(using Docker for Windows) can get this running without problems with the same compose file?

Thanks

标签: dockerdocker-composedockerfiledocker-toolbox

解决方案


Docker Desktop 和 Toolbox 是完全不同的产品。Docker Desktop 在 Hyper-V 上运行,Docker Toolbox 在 Virtualbox 上运行。Desktop 是实际产品,Toolbox 是“遗留桌面解决方案”。

可以操纵其 IP 地址。如果您查看“选项”下的文档,您会发现一个名为 virtualbox-hostonly-cidr 的选项,您可以在创建新机器时使用它来操作 IP 地址。但在您尝试此操作之前,请注意它被称为“hostonly”。这意味着它使用 Virtualbox Host-Only 适配器,并且“虚拟机无法与主机外部的世界通信,因为它们没有连接到物理网络接口”(来自 Virtualbox 文档)。

所以不幸的是,您的问题似乎没有简单的解决方案。


推荐阅读