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?
Asked
Active
Viewed 1.4k times
8
-
1@PatrickAleman that would be a good answer – Ingo Kegel Apr 13 '15 at 13:32
-
Possible duplicate of [Remote profilling java application](http://stackoverflow.com/questions/7571247/remote-profilling-java-application) – the8472 Aug 09 '16 at 20:27
-
But the answer of that question is not the same thing I asked – shawn Aug 09 '16 at 21:08
-
remote just means a subset of anything you can also do locally or with containers, therefore it is applicable here. – the8472 Aug 09 '16 at 22:28
3 Answers
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

Andrew Liu
- 351
- 1
- 9
-
I found I had to map the port after following the guide. docker run -p 8849:8849 imageName – Will Humphreys Apr 29 '17 at 19:40
4
You can use this dockerfile; https://registry.hub.docker.com/u/gingerbeard/java8-jprofiler/dockerfile/
FROM dockerfile/java:oracle-java8
MAINTAINER gingerbeard <kulishovt@gmail.com>
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.

Matt
- 74,352
- 26
- 153
- 180

Patrick Aleman
- 612
- 6
- 19
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.

Ingo Kegel
- 46,523
- 10
- 71
- 102
-
1I'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. – shawn Aug 10 '16 at 18:36