Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]:docker部署时 net=host ,app_info.json读取宿主机 本机ip的 bug #957

Closed
tushengtao opened this issue Jun 29, 2023 · 9 comments · Fixed by #1019
Closed

[BUG]:docker部署时 net=host ,app_info.json读取宿主机 本机ip的 bug #957

tushengtao opened this issue Jun 29, 2023 · 9 comments · Fixed by #1019
Labels
bug Something isn't working
Milestone

Comments

@tushengtao
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is, ideally within 20 words.
docker部署时 net=host ,app_info.json读取宿主机 本机ip的 bug,具体情况描述如图片:

image

iLogtail Running Environment
Please provide the following information:

  • ilogtail version:
    1.5.1

  • Yaml configuration:

  • ilogtail.LOG:

  • logtail_plugin.LOG:

@tushengtao tushengtao added the bug Something isn't working label Jun 29, 2023
@tushengtao tushengtao changed the title [BUG]: [BUG]:docker部署时 net=host ,app_info.json读取宿主机 本机ip的 bug Jun 29, 2023
@yyuuttaaoo
Copy link
Collaborator

请问一下,在容器内执行hostname -i得到的IP是哪个?

@tushengtao
Copy link
Contributor Author

docker run -d --net=host --name docker-log registry.cn-hangzhou.aliyuncs.com/log-service/logtail
上面是我运行容器的命令。
image

上面是容器内的情况,app_info.json获取的ip不对,应该获取172.24.17.103 而不是 172.23.57.58
image
上面是我宿主机的ip
image
上面是宿主机里面执行的相关命令

@tushengtao
Copy link
Contributor Author

tushengtao commented Jun 29, 2023

我觉得 云服务器这种情况应该蛮多的吧,简单的方法就是 部署文档里完善一下,我们目前的方案就是 docker 运行加add-host 读取宿主机的真实有效ip。看了你们源码 这一块逻辑处理的蛮简单的 ,在 MachineInfoUtil.cpp

@messixukejia
Copy link
Collaborator

这个事情下次双周会能否一起来交流下?

@tushengtao
Copy link
Contributor Author

请问是什么时间,怎样的流程? 以及我需要准备什么?

@messixukejia
Copy link
Collaborator

image
关注下这里的公告吧,我们也会群里发。

可以把自己的想法在这个discussion中描述下,到时候会上发表意见就可以了。

@yyuuttaaoo
Copy link
Collaborator

yyuuttaaoo commented Jul 12, 2023

可以考虑将h_addr_list里的address都取下来,并使用ifr_addr的地址做校验,校验通过的优先作为本机地址,如果都通不过还是取第一个。这样既不破坏既有顺序,也不会轻易取到错误地址。

@tushengtao
Copy link
Contributor Author

可以考虑将h_addr_list里的address都取下来,并使用ifr_addr的地址做校验,校验通过的优先作为本机地址,如果都通不过还是取第一个。这样既不破坏既有顺序,也不会轻易取到错误地址。

是的,这个思路可以的,预计近两天会提交上去。

@messixukejia
Copy link
Collaborator

TuShengTao

👍🏻,方便的话可以在这里登记下使用场景,多谢。#693

ilogtail发展离不开大家的共同努力。

@yyuuttaaoo yyuuttaaoo linked a pull request Nov 8, 2023 that will close this issue
@yyuuttaaoo yyuuttaaoo added this to the v1.8 milestone Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants