WSO2 not compatible with Docker

2019-06-05 01:03发布

问题:

I had to shutdown wso2server to test an other API management tool on the same machine. The other tool provided a quick setup running on Docker so I had to install docker.

Now, when I shutdown every docker services and start wso2server again, it looks like some services detect docker virtual interface IP (172.17.0.1) instead of using the real 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

Log from a previous day with expected 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}

This doesnt prevent WSO2 to start, but it prevents Swagger-UI to work because it's trying to reach services on 172.17.0.1 ending in timeout since this IP doesn't correspond to anything.

What can I do in order to have the real IP is detected again ?

回答1:

You can set required IP in carbon.xml

<!--
   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-->

And you may have to replace ${carbon.local.ip} in api-manager.xml by required IP too.



回答2:

In addition to above we also need to edit the /wso2am-2.0.0/repository/conf/api-manager.xml file and change url value of <GatewayEndpoint> replace ${carbon.local.ip}