All Products
Search
Document Center

Install ARMS Agent in Docker environments

Last Updated: Mar 25, 2019

This topic describes how to install ARMS Agent in Docker environments based on Tomcat applications, Jetty applications, and Spring Boot running environments.

Install ARMS Agent in Docker environments based on Tomcat applications

  1. Edit Dockerfile to integrate existing images.

    If Tomcat applications are available in your Docker image {original-docker-image:tag}, you can integrate this image to generate new sub-images. Dockerfile:

    1. ########################################
    2. ## ###
    3. ## ARMS APM DEMO Docker ###
    4. ## For Tomcat ###
    5. ## withAgent V0.1 ###
    6. ## ###
    7. ########################################
    8. FROM {original-docker-image:tag}
    9. WORKDIR /root/
    10. # Replace the ARMS Agent download address based on the region, as described at the end of this topic.
    11. RUN wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    12. RUN unzip ArmsAgent.zip -d /root/
    13. # If all images are connected to the same application, configure arms_licenseKey and arms_appId.
    14. # You can locate licenseKey and appId on the Application Settings page.
    15. # To connect images to other applications, you can overwrite the original configuration by using the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application.
    16. ENV arms_licenseKey=XXX
    17. ENV arms_appId=XXX
    18. ENV CATALINA_OPTS '-javaagent:/root/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar -Darms.licenseKey=$arms_licenseKey -Darms.appId=$arms_appId'

    Note:

    • Replace original-docker-image:tag with your image address.
    • Replace the ARMS Agent download address based on the region, as detailed at the end of this topic.
    • Replace the values of arms_licenseKey and arms_appId with the values displayed on the Application Settings page.
  2. Run the docker build command to build images.

    The image name arms-agent-tomcat-demo:v0.1 in the following command is for reference only. You can change the name as needed.

    1. docker build -t arms-agent-tomcat-demo:v0.1 -f /{workspace}/Dockerfile /{workspace}/
  3. Run the docker run command to start images.

    Execute the docker run start script of the original image {original-docker-image:tag} to start images. To connect images to other applications, you can use the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application to overwrite the original configuration of Dockerfile.

    Example:

    1. docker run -d -e "arms_licenseKey=aokcdqn3ly@03cd8c21942bee9" -e "arms_appId=aokcdqn3ly@87c740b4fd128b8" -p 8081:8080 arms-agent-tomcat-demo:v0.1

Install ARMS Agent in Docker environments based on Jetty applications

  1. Edit Dockerfile to integrate existing images.

    If Jetty applications are available in the Docker image {original-docker-image:tag}, you can integrate this image to generate new sub-images. Dockerfile:

    1. ########################################
    2. ## ###
    3. ## ARMS APM DEMO Docker ###
    4. ## For Jetty ###
    5. ## withAgent V0.1 ###
    6. ## ###
    7. ########################################
    8. FROM {original-docker-image:tag}
    9. WORKDIR /root/
    10. # Replace the ARMS Agent download address based on the region, as detailed at the end of this topic.
    11. RUN wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    12. RUN unzip ArmsAgent.zip -d /root/
    13. # If all images are connected to the same application, configure arms_licenseKey and arms_appId.
    14. # You can locate licenseKey and appId on the Application Settings page.
    15. # To connect images to other applications, you can use the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application to overwrite the original configuration.
    16. ENV arms_licenseKey=XXX
    17. ENV arms_appId=XXX
    18. ENV JAVA_OPTIONS '-javaagent:/root/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar -Darms.licenseKey=$arms_licenseKey -Darms.appId=$arms_appId'

    Note:

    • Replace original-docker-image:tag with your image address.
    • Replace the ARMS Agent download address based on the region, as detailed at the end of this topic.
    • Replace the values of arms_licenseKey and arms_appId with the values displayed on the Application Settings page.
  2. Run the docker build command to build images.

    The image name arms-agent-jetty-demo:v0.1 in the following command is for reference only. You can change the name as needed.

    1. docker build -t arms-agent-jetty-demo:v0.1 -f /{workspace}/Dockerfile /{workspace}/
  3. Run the docker run command to start images.

    Execute the docker run start script of the original image {original-docker-image:tag} to start images. To connect images to other applications, you can use the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application to overwrite the original configuration of Dockerfile.

    Example:

    1. docker run -d -e "arms_licenseKey=aokcdqn3ly@03cd8c21942bee9" -e "arms_appId=aokcdqn3ly@87c740b4fd128b8" -p 8081:8080 arms-agent-jetty-demo:v0.1

Install ARMS Agent in Docker environments based on Spring Boot running environments

  1. Modify the Dockerfile script.

    As Spring Boot is run directly using the java -jar XXX.jar command, you need to modify your Dockerfile and then run the docker build command again.

    1. # If all images are connected to the same application, configure arms_licenseKey and arms_appId.
    2. # You can locate licenseKey and appId on the Application Settings page.
    3. # To connect images to other applications, you can use the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application to overwrite the original configuration.
    4. ENV arms_licenseKey=XXX
    5. ENV arms_appId=XXX
    6. # Replace the ARMS Agent download address based on the region, as detailed at the end of this topic.
    7. RUN wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    8. RUN unzip ArmsAgent.zip -d /root/
    9. ## Locate the java -jar command for starting Spring Boot before -jar.
    10. # Modify the script as needed.
    11. RUN java -javaagent:/root/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar -Darms.licenseKey=$arms_licenseKey -Darms.appId=$arms_appId -jar XXX-springboot.jar
  2. Run the docker run command to start images.

    Execute the docker run start script of the original image {original-docker-image:tag} to start images. To connect images to other applications, you can use the -e parameter in the docker run command to specify the arms_licenseKey and arms_appId parameters for the application to overwrite the original configuration of Dockerfile.

    Example:

    1. docker run -d -e "arms_licenseKey=aokcdqn3ly@03cd8c21942bee9" -e "arms_appId=aokcdqn3ly@87c740b4fd128b8" -p 8081:8080 arms-agent-springboot-demo:v0.1

ARMS Agent download addresses in different regions

  1. # Hangzhou region
  2. wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  3. # Shanghai region
  4. wget "http://arms-apm-shanghai.oss-cn-shanghai.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  5. # Qingdao region
  6. wget "http://arms-apm-qingdao.oss-cn-qingdao.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  7. # Beijing region
  8. wget "http://arms-apm-beijing.oss-cn-beijing.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  9. # Shenzhen region
  10. wget "http://arms-apm-shenzhen.oss-cn-shenzhen.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  11. # Singapore region
  12. wget "http://arms-apm-ap-southeast.oss-ap-southeast-1.aliyuncs.com/cloud_ap-southeast-1/ArmsAgent.zip" -O ArmsAgent.zip
  13. # AntCloud environment
  14. wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/finance/ArmsAgent.zip" -O ArmsAgent.zip