Can Jprofile connect to JVM running in docker
Asked Answered
D

3

8

I'm new to JProfiler. I came into a problem recently. My Java app is running in docker which means the JVM is runnning in docker. But my jprofile is installed in the host machine. I know the jprofiler must connect to a JVM. So, is there anyway that the jprofiler can connect to jvm running in docker?

Drusy answered 9/8, 2016 at 19:1 Comment(4)
@PatrickAleman that would be a good answerSpinescent
Possible duplicate of Remote profilling java applicationPebble
But the answer of that question is not the same thing I askedDrusy
remote just means a subset of anything you can also do locally or with containers, therefore it is applicable here.Pebble
K
5

It is similar as connects JProfiler to a remote JVM, you just need to have the JProfiler agent ready inside your container and expose the port.

This post has a step by step guide http://geekspearls.blogspot.com.au/2016/08/configure-jprofiler-92-to-profiling.html

Kanter answered 30/8, 2016 at 4:37 Comment(1)
I found I had to map the port after following the guide. docker run -p 8849:8849 imageNameGehlbach
A
4

You can use this dockerfile; https://registry.hub.docker.com/u/gingerbeard/java8-jprofiler/dockerfile/

FROM dockerfile/java:oracle-java8
MAINTAINER gingerbeard <[email protected]>

RUN wget http://download-aws.ej-technologies.com/jprofiler/jprofiler_linux_8_1_2.tar.gz -P /tmp/ &&\
 tar -xzf /tmp/jprofiler_linux_8_1_2.tar.gz -C /usr/local &&\
 rm /tmp/jprofiler_linux_8_1_2.tar.gz

ENV JPAGENT_PATH="-agentpath:/usr/local/jprofiler8/bin/linux-x64/libjprofilerti.so=nowait"
EXPOSE 8849

CMD ["bash"]

make sure to check the ports.

Antarctic answered 17/4, 2015 at 12:28 Comment(0)
S
0

The JProfiler GUI connects to the profiling agent that is loaded in the profiled JVM through a TCP socket.

This is always the case, also if the profiled JVM and the JProfiler GUI are running on the same machine.

Invoking "Session->Integration wizards->New remote integration" will give you the instructions to set this up manually.

Spinescent answered 10/8, 2016 at 7:42 Comment(1)
I've figured it out. The right way is install jprofiler inside the container with your java app. Start the jprofiler using "docker exec" in your host machine. Then u can monitor your container in your local machine.Drusy

© 2022 - 2024 — McMap. All rights reserved.