dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

In the docker container environment, dubbo 2.7.14+ version use problem

Open ChinaJeckXu opened this issue 3 years ago • 4 comments

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.14、2.7.15
  • Operating System version: Linux Centos7.9 Docker 20.10.5
  • Java version: 1.8.0_202

Steps to reproduce this issue

  1. docker container start command:docker run -d --name abc --net=host xxx:xxx
  2. In the previous version 2.7.9, the address that dubbo reported to the registry after the container was started was the host IP, such as: [192.168.1.100], this is correct, because the docker start command uses --net=host, However, in the latest version 2.7.14 and 2.7.15, the address reported by dubbo to the registry is the internal IP of the container, such as 172.17.0.1. In this case, in the development environment we usually use, the development machine used by the program developer is Unable to connect to the dubbo service started by the container.

Pls. provide [GitHub address] to reproduce this issue.

Expected Behavior

Actual Behavior

If there is an exception, please attach the exception trace:

Just put your stack trace here!

ChinaJeckXu avatar Dec 31 '21 02:12 ChinaJeckXu

你用的 jdk 版本是多少,我用 1.8.0_181 测试是没问题的

juzi214032 avatar Jan 01 '22 02:01 juzi214032

你用的 jdk 版本是多少,我用 1.8.0_181 测试是没问题的

java version "1.8.0_202" Java(TM) SE Runtime Environment (build 1.8.0_202-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

ChinaJeckXu avatar Jan 04 '22 05:01 ChinaJeckXu

你用的 jdk 版本是多少,我用 1.8.0_181 测试是没问题的

需要说明的是,我之前用的dubbo-2.7.9所在的JDK环境也是1.8.0_202

ChinaJeckXu avatar Jan 07 '22 03:01 ChinaJeckXu

https://github.com/apache/dubbo/issues/9617 相似的问题。 使用arthas // 获取NetUtils 实例hash sc -d *NetUtils // 使用ognl调用org.apache.dubbo.common.utils.NetUtils#getValidNetworkInterfaces ognl -c 7728643a -x 3 '@org.apache.dubbo.common.utils.NetUtils@getValidNetworkInterfaces()' 发现网卡列表里docker0网卡在我们的物理网卡之前 @LinkedList[ .... @NetworkInterface[ name=@String[docker0], displayName=@String[docker0], ], @NetworkInterface[ name=@String[ens192], displayName=@String[ens192], ], ] 2.7.14之前用的break,这只是中断了while循环。2.7.14我猜测是为了修复这个逻辑bug,结果走到docker0之后就退出了。

iJIAJIA avatar Jan 27 '22 02:01 iJIAJIA

related to 在docker环境下部署服务

chickenlj avatar Sep 08 '22 01:09 chickenlj