Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.2.16, 4.3.8, 4.4.2
-
None
-
None
-
Debian 11.3
Docker version 20.10.17, build 100c701
Description
We noticed a problem with access to JMX in the case that karaf is running in a docker container and uses a different network than the host. Last versions of apache karaf where were working example below are 4.3.0, 4.2.11.
The given problem does not allow us to use JMX monitoring and simultaneously separate individual docker networks from the host network.
Please see example below:
working version, docker network=host
docker run -it -d --name=test.4.4.2 --network=host -e ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYHOST='172.21.51.155' -e ORG_APACHE_KARAF_MANAGEMENT_RMISERVERHOST='172.21.51.155' -e KARAF_DEBUG=true -p 1099:1099 -p 44444:44444 apache/karaf:4.4.2
docker exec -it test.4.4.2 /bin/bash sed -i 's/rmiServerHost = 127.0.0.1/rmiServerHost = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMISERVERHOST}/' /opt/apache-karaf/etc/org.apache.karaf.management.cfg sed -i 's/rmiRegistryHost = 127.0.0.1/rmiRegistryHost = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYHOST}/' /opt/apache-karaf/etc/org.apache.karaf.management.cfg sed -i 's/#karaf = karaf,_g_:admingroup/karaf = karaf,_g_:admingroup/' /opt/apache-karaf/etc/users.properties sed -i 's/#_g_\\:admingroup = /_g_\\:admingroup = /' /opt/apache-karaf/etc/users.properties echo 'java.rmi.server.hostname=172.21.51.155' >> /opt/apache-karaf/etc/system.properties exit docker restart test.4.4.2
Connect to service:jmx:rmi:///jndi/rmi://172.21.51.155:1099/karaf-root was successful.
not-working version, docker network=test
docker network create test docker run -it -d --name=test.4.4.2 --network=test-e ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYHOST='0.0.0.0' -e ORG_APACHE_KARAF_MANAGEMENT_RMISERVERHOST='0.0.0.0' -e KARAF_DEBUG=true -p 1099:1099 -p 44444:44444 apache/karaf:4.4.2
docker exec -it test.4.4.2 /bin/bash sed -i 's/rmiServerHost = 127.0.0.1/rmiServerHost = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMISERVERHOST}/' /opt/apache-karaf/etc/org.apache.karaf.management.cfg sed -i 's/rmiRegistryHost = 127.0.0.1/rmiRegistryHost = ${env:ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYHOST}/' /opt/apache-karaf/etc/org.apache.karaf.management.cfg sed -i 's/#karaf = karaf,_g_:admingroup/karaf = karaf,_g_:admingroup/' /opt/apache-karaf/etc/users.properties sed -i 's/#_g_\\:admingroup = /_g_\\:admingroup = /' /opt/apache-karaf/etc/users.properties echo 'java.rmi.server.hostname=172.21.51.155' >> /opt/apache-karaf/etc/system.properties exit docker restart test.4.4.2
Connect to service:jmx:rmi:///jndi/rmi://172.21.51.155:1099/karaf-root was unsuccessful.
Attachments
Issue Links
- relates to
-
KARAF-7443 JMX: rmiRegistryHost=0.0.0.0 Runtime IO exception: no such object in table
- Resolved