WSO2 与 Docker 不兼容

WSO2 not compatible with Docker

我不得不关闭 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?

您可以在 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-->

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

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