Connecting a Native Docker Application to APM
If you have a Java application image, you can add the parameters required by the Java probe to the native Docker startup command. In this case, by starting the image, you can connect the Java application to Application Performance Management (APM), and then view application data on the topology and transaction pages.
Prerequisite
You have deployed a Java application in Docker.
Procedure

Step 1: Subscribe to APM
Step 2: Install the ICAgent
- Obtain an Access Key ID/Secret Access Key (AK/SK).
- Log in to the APM console.
- In the navigation pane, choose Agent > Management.
- Click Install ICAgent. On the page that is displayed, set Host to HUAWEI CLOUD host and OS to Linux.
- Select the Obtain AK/SK installation mode, enter the obtained AK/SK in the text box to generate the ICAgent installation command, and click Copy Command.
Ensure that the AK/SK are correct. Otherwise, the ICAgent cannot be installed.

- Remotely log in to the Elastic Cloud Server (ECS) server as the root user and run the preceding command to install the ICAgent.
When the message "ICAgent install success" is displayed, the ICAgent is successfully installed in the /opt/oss/servicemgr/ directory.
(Optional) Step 3: Modify Permissions
If you start the program as a non-root user, run the following commands to modify the permissions on the probe file and output directory before enabling application monitoring:
chmod -R 777 /opt/oss/servicemgr/ICAgent/pinpoint/ mkdir -p /opt/apm-container chmod -R 777 /opt/apm-container
Step 4: Start an Image
Add the parameters required by the Java probe to the native Docker startup command, and adjust the application and service names as required. The following shows an example of the VMall application with the vmall-dao-service service.
- Modify the Docker startup script. Original startup command:
docker run -p 8080:8080 demo:latest
Modified startup command:docker run -e JAVA_TOOL_OPTIONS="-javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-dao-service -Dapm_container=true" -v /opt/apm-container:/paas-apm/collectors/pinpoint -v /opt/oss/servicemgr/ICAgent/pinpoint:/opt/oss/servicemgr/ICAgent/pinpoint -p 8080:8080 demo:latest
- Run the docker run command to start the image, so that the Docker application can be connected to the APM console.
Step 5: Manage the Application on APM
Three minutes after the application is started, its data will be displayed on the APM console. You can log in to the APM console and optimize application performance through topology and tracing. For details, see APM User Guide.

Last Article: Connecting a HUAWEI CLOUD Containerized Application to APM
Next Article: Connecting a Deployment Application to APM
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.