如何在 Docker 环境安装 OneAPM Ai Java 探针

faq
docker
ai
java
apm

#1

Dockerfile Example

FROM centos:7

MAINTAINER liuyuanli <liuyuanli@oneapm.com>

ARG APP_NAME
ARG TIER_NAME

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#进入应用程序的目录:如 /app/tomcat/
&& cd /app/tomcat \
&& wget http://apmdv.oneapm.com/download/javaagent-linux-x64-lastversion.zip \
&& unzip javaagent-linux-x64-lastversion.zip  \
&& cd OneAPM/ \
&& sed -i "s|app_name = .*$|app_name = ${APP_NAME}|" oneapm.properties \
&& sed -i "s|tier_name = .*$|tier_name = ${TIER_NAME}|" oneapm.properties \
&& java -jar oneapm.jar install

WORKDIR /app

CMD ["./tomcat/bin/startup.sh"]

Docker Build

docker build -t javaappimage1 --build-arg APP_NAME=testap1 --build-arg TIER_NAME=tiername1 .
Docker Run 
docker run -p 8888:8888 -d javaappimage1

供参考


SaaS Ai 旧版(v3.x)到新版 Java 探针升级方法