【问题标题】:WSO2 not compatible with DockerWSO2 与 Docker 不兼容
【发布时间】:2016-11-04 15:53:06
【问题描述】:

我必须关闭 wso2server 才能在同一台机器上测试其他 API 管理工具。另一个工具提供了在 Docker 上运行的快速设置,所以我必须安装 docker。

现在,当我关闭每个 docker 服务并再次启动 wso2server 时,看起来有些服务检测到 docker 虚拟接口 IP (172.17.0.1) 而不是使用真实 IP (10.22.106.101):

[2016-11-04 16:33:21,452]  INFO - CarbonUIServiceComponent Mgt Console URL  : https://172.17.0.1:9443/carbon/
[2016-11-04 16:33:21,452]  INFO - CarbonUIServiceComponent API Publisher Default Context : https://172.17.0.1:9443/publisher
[2016-11-04 16:33:21,452]  INFO - CarbonUIServiceComponent API Store Default Context : https://172.17.0.1:9443/store

使用预期 IP 记录前一天的日志:

[2016-09-15 15:38:24,534]  INFO {org.wso2.carbon.ui.internal.CarbonUIServiceComponent} -  Mgt Console URL  :
 https://10.22.106.101:9443/carbon/ {org.wso2.carbon.ui.internal.CarbonUIServiceComponent}
[2016-09-15 15:38:24,534]  INFO {org.wso2.carbon.ui.internal.CarbonUIServiceComponent} -  API Publisher Defa
ult Context : https://10.22.106.101:9443/publisher {org.wso2.carbon.ui.internal.CarbonUIServiceComponent}
[2016-09-15 15:38:24,534]  INFO {org.wso2.carbon.ui.internal.CarbonUIServiceComponent} -  API Store Default
Context : https://10.22.106.101:9443/store {org.wso2.carbon.ui.internal.CarbonUIServiceComponent}

这不会阻止 WSO2 启动,但会阻止 Swagger-UI 工作,因为它试图访问 172.17.0.1 上的服务,但由于此 IP 不对应任何内容,因此超时结束。

如何才能再次检测到真实 IP?

【问题讨论】:

    标签: docker wso2 swagger-ui


    【解决方案1】:

    您可以在carbon.xml中设置所需的IP

    <!--
       Host name or IP address of the machine hosting this server
       e.g. www.wso2.org, 192.168.1.10
       This is will become part of the End Point Reference of the
       services deployed on this server instance.
    -->
    <!--HostName>www.wso2.org</HostName-->
    
    <!--
    Host name to be used for the Carbon management console
    -->
    <!--MgtHostName>mgt.wso2.org</MgtHostName-->
    

    您可能还需要将 api-manager.xml 中的 ${carbon.local.ip} 替换为所需的 IP。

    【讨论】:

    • 感谢您的快速回答,这让我走上了正轨,但您的“您可能”并不真正令人满意,就好像您不确定您在说什么。有关此 ${carbon.local.ip} 自动设置的详细信息:mail.wso2.org/mailarchive/dev/2014-March/028681.html。所以它不是“你可以”,当检测到的 IP 不是你期望你必须手动替换所有 ${carbon.local.ip} 出现的 IP 时。
    【解决方案2】:

    除上述之外,我们还需要编辑/wso2am-2.0.0/repository/conf/api-manager.xml文件并更改&lt;GatewayEndpoint&gt;的url值替换${carbon.local.ip}

    【讨论】:

    • 不是上面的补充。上面的评论说:“你必须手动替换所有 ${carbon.local.ip} 出现”。此外,您应该使用“添加评论”而不是创建新答案来说明这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 1970-01-01
    • 1970-01-01
    • 2020-12-02
    • 1970-01-01
    • 1970-01-01
    • 2018-07-04
    相关资源
    最近更新 更多