什么是 linux 相当于“host.docker.internal"? [英] What is linux equivalent of "host.docker.internal"

查看:212
本文介绍了什么是 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(Docker18.03+) 在容器内.

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.

有没有一种适用于 Linux 的工具可以在不传递环境变量或使用各种 CLI 命令提取它的情况下开箱即用?

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

推荐答案

取决于您要尝试做什么.如果您使用 --net=host 运行,localhost 应该可以正常工作.如果您使用默认网络,请使用静态 IP 172.17.0.1.我怀疑两者的行为都不会与那些域完全相同.

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天全站免登陆