DEV Community

kgoedert
kgoedert

Posted on

3 2

Monitoring Wildfly inside docker

To monitor a wildfly instance that is running inside a docker container, is not as simple as simply exposing the port and connecting to it. The first thing you are going to need is to download a wildfly copy of the same version you are running inside the container, on the host machine you are going to use.

On your docker file you are going to need to add a user to your container, that will be able to connect to the administration interface, and expose a port. Since you are going to create a user that can alter the server configurations, think carefully before putting this in a production environment. To do that add a line like this to your Dockerfile:

RUN /opt/jboss/wildfly/bin/add-user.sh adm Password1! --silent

EXPOSE 9990

The name of the user and passoword can be whatever you want. The name admin, is taken by wildfly already, so I used adm. And 9990 is the port you need to expose, and then map to.

Once you have your container built and running (don't forget to map the port), you need to know which is your container internal IP address. One way to check that is with the command:

docker inspect <container-id>

In the output shown, you are going to have something like this:

"IPAddress": "172.21.0.2",

Now, everything related to the container is ready.

JConsole

If you want to connect with JConsole, in the host machine where you downloaded wildlfy go to $WILDFLY_HOME/bin and execute:

./jconsole.sh

On the window that shows up, check Remote Process, in the box, you need something like service:jmx:remote+http://172.17.0.2:9990, where the IP address is the one from your docker container. And in the username and password boxes type whatever you configured on your Dockerfile. Then, connect.

VisualVM

If you want to use VisualVM, first you need to install it:

sudo apt-get install visualvm

All the first part of configuring the container, is exactly the same. What is different here is that you need to add wildfly client API to visualvm classpath, so it can connect.

To do that, you run visualvm like this:

visualvm --cp:a $WILDFLY_HOME/bin/client/jboss-client.jar

Then, add a remote host and a JMX connection, using the same parameters used for JConsole.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay