linux上等同于"host.docker.internal"的主机 [英] What is linux equivalent of "host.docker.internal"

查看:1393
本文介绍了linux上等同于"host.docker.internal"的主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac和Windows上,可以在容器内使用 docker.for.mac.host.internal(代替docker.for.mac.localhost)和docker.for.win.host.internal(代替docker.for.win.localhost) host.docker.internal(Docker 18.03+)./p>

有没有一个Linux可以直接使用而无需传递env变量或使用各种cli命令提取它.

解决方案

取决于您要执行的操作.如果您使用--net=host运行,则localhost应该可以正常工作.如果使用默认网络,请使用静态IP 172.17.0.1.我怀疑这两个域名的行为都不会完全相同.

On Mac and Windows it is possible to use docker.for.mac.host.internal (replaces docker.for.mac.localhost) and docker.for.win.host.internal (replaces docker.for.win.localhost) host.docker.internal (Docker 18.03+) inside container.

Is there one for Linux that will work out of the box without passing env variables or extracting it using various cli commands.

解决方案

Depends what you're trying to do. If you're running with --net=host, localhost should work fine. If you're using default networking, use the static IP 172.17.0.1. I suspect neither will behave quite the same as those domains.

这篇关于linux上等同于"host.docker.internal"的主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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