我有一个情况:需要让由docker-compose 1.16.1协同管理的单个docker容器内的几个作业与遗留系统通信。遗留系统在同一主机上以vagrant box运行,并绑定到三个端口(7880、58608和58709)。我知道docker的默认配置允许将主机访问为172.17.0.1,但由于网络差异的晦涩技术原因,我需要“localhost”上的主机端口可用。那么,我该如何使在docker容器内从“localhost端口7880”(按)可见到主机端口7880?我完全控制docker实例和调用。
localhost
resolves to the loopback address (127.0.0.1) of the container itself. Changing this might brake things. Have you considered any other option? For example adding an entry to your/etc/hosts
, something like172.17.0.1 my_docker_host
... You will then access your legacy system atmy_docker_host:7880
- tgogos