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
供参考