{"action":"closed","issue":{"url":"https://api.github.com/repos/alibaba/dubbo/issues/1289","repository_url":"https://api.github.com/repos/alibaba/dubbo","labels_url":"https://api.github.com/repos/alibaba/dubbo/issues/1289/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/dubbo/issues/1289/comments","events_url":"https://api.github.com/repos/alibaba/dubbo/issues/1289/events","html_url":"https://github.com/alibaba/dubbo/issues/1289","id":292263303,"number":1289,"title":"dubbo provider side can't find service when deployed in docker.","user":{"login":"skiof007","id":12826300,"avatar_url":"https://avatars2.githubusercontent.com/u/12826300?v=4","gravatar_id":"","url":"https://api.github.com/users/skiof007","html_url":"https://github.com/skiof007","followers_url":"https://api.github.com/users/skiof007/followers","following_url":"https://api.github.com/users/skiof007/following{/other_user}","gists_url":"https://api.github.com/users/skiof007/gists{/gist_id}","starred_url":"https://api.github.com/users/skiof007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skiof007/subscriptions","organizations_url":"https://api.github.com/users/skiof007/orgs","repos_url":"https://api.github.com/users/skiof007/repos","events_url":"https://api.github.com/users/skiof007/events{/privacy}","received_events_url":"https://api.github.com/users/skiof007/received_events","type":"User","site_admin":false},"labels":[{"id":7331964,"url":"https://api.github.com/repos/alibaba/dubbo/labels/type/bug","name":"type/bug","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/alibaba/dubbo/milestones/14","html_url":"https://github.com/alibaba/dubbo/milestone/14","labels_url":"https://api.github.com/repos/alibaba/dubbo/milestones/14/labels","id":3082667,"number":14,"title":"2.5.10","description":"","creator":{"login":"chickenlj","id":18097545,"avatar_url":"https://avatars1.githubusercontent.com/u/18097545?v=4","gravatar_id":"","url":"https://api.github.com/users/chickenlj","html_url":"https://github.com/chickenlj","followers_url":"https://api.github.com/users/chickenlj/followers","following_url":"https://api.github.com/users/chickenlj/following{/other_user}","gists_url":"https://api.github.com/users/chickenlj/gists{/gist_id}","starred_url":"https://api.github.com/users/chickenlj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chickenlj/subscriptions","organizations_url":"https://api.github.com/users/chickenlj/orgs","repos_url":"https://api.github.com/users/chickenlj/repos","events_url":"https://api.github.com/users/chickenlj/events{/privacy}","received_events_url":"https://api.github.com/users/chickenlj/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":3,"state":"open","created_at":"2018-02-02T01:46:59Z","updated_at":"2018-02-09T09:00:26Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-01-29T02:00:39Z","updated_at":"2018-02-09T09:00:26Z","closed_at":"2018-02-09T09:00:26Z","author_association":"NONE","body":"有些部署场景需要动态指定服务注册的地址，如docker bridge网络模式下要指定注册宿主机ip以实现外网通信。dubbo提供了两对启动阶段的系统属性，用于设置对外通信的ip、port地址  \r\n\r\nDUBBO_IP_TO_REGISTRY --- 注册到注册中心的ip地址\r\nDUBBO_PORT_TO_REGISTRY --- 注册到注册中心的port端口\r\n\r\ndocker环境下对外服务的端口为DUBBO_PORT_TO_REGISTRY,但服务提供端在读取端口号时读取到的是本地端口号导致无法找到对应的服务。BUG信息如下：\r\nNot found exported service: hbec.app.test.service.TestService:20881 in [hbec.app.test.service.TestService:31838]\r\n\r\n问题代码如下:\r\nDubboProtocol类\r\n  Invoker<?> getInvoker(Channel channel, Invocation inv) throws RemotingException {\r\n        boolean isCallBackServiceInvoke = false;\r\n        boolean isStubServiceInvoke = false;\r\n        int port = channel.getLocalAddress().getPort();//# 注:在docker环境下该端口取的是本地端口，非环境变量端口\r\n        String path = inv.getAttachments().get(Constants.PATH_KEY);\r\n        // if it's callback service on client side\r\n        isStubServiceInvoke = Boolean.TRUE.toString().equals(inv.getAttachments().get(Constants.STUB_EVENT_KEY));\r\n        if (isStubServiceInvoke) {\r\n            port = channel.getRemoteAddress().getPort();\r\n        }\r\n\r\n\r\n  "}}
{"actor":{"display_login":"chickenlj"}}