DockerFile should have JProfiler installation.
RUN wget <JProfiler file location> -P /tmp/ && \
tar -xzf /tmp/<JProfiler file> -C /usr/local && \
rm /tmp/<JProfiler file>
EXPOSE <port>
e.g.)
RUN wget https://download-gcdn.ej-technologies.com/jprofiler/jprofiler_linux_12_0_2.tar.gz -P /tmp/ && \
tar -xzf /tmp/jprofiler_linux_12_0_2.tar.gz -C /usr/local &&\
rm /tmp/jprofiler_linux_12_0_2.tar.gz
EXPOSE 8849
docker run -p <port>:<port> your-docker
e.g.)
docker run -p 8849:8849 your-docker
java -agentpath:/usr/local/jprofiler9/bin/linux-x64/libjprofilerti.so=port=<port> -jar my-app.jar
e.g.)
java -agentpath:/usr/local/jprofiler9/bin/linux-x64/libjprofilerti.so=port=8849 -jar my-app.jar
So in the DockerFile
, it looks like
ENTRYPOINT ["java", "-agentpath:/usr/local/jprofiler9/bin/linux-x64/libjprofilerti.so=port=8849", "-jar", "my-app.jar"]
If the docker server is a remote service reachable from SSH, I would just
- Open a SSH tunnel
ssh -L 8849:localhost:8849 host
- Connect with Jprofiler to localhost:8849
Original instructions
- Select '
Profile an application server, locally or remotely
'. - If the target application is running on any specific server listed, select it. Otherwise, choose
Generic application
. - Select
Linux X86/AMD64
forPlatform of the remote computer
on a remote computer. - Select the JVM used in the Docker instance.
- To make JProfiler to wait for the application to start and send data, select
Wait for a connection from the JProfiler GUI
. - Enter the remote address to the
Remote address
. If it's Docker for Mac, it islocalhost
. If Docker Machine is used, use the IP of the Docker Machine. - Add the path to the JProfiler on the Docker where the jar file metioned above is using to the
Remote installation directory
. It looks like/usr/local/jprofiler<version>
. e.g.) /usr/local/jprofiler9 - Set the port number or use the default (i.e. 8849).