hi,
i am trying to mount an application in gke with java apm-agent, with the following dockerfile:
FROM adoptopenjdk:11-jre-hotspot
RUN export
RUN apt-get -qq update \
&& apt-get install --no-install-recommends -y -qq curl \
&& rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true
WORKDIR /app
COPY . ./
ENV JAVA_OPTS="-Xmx512m"
LABEL \
org.label-schema.schema-version="1.0" \
org.label-schema.vendor="Elastic" \
org.label-schema.name="opbeans-java" \
org.label-schema.version="1.18.1" \
org.label-schema.url="https://hub.docker.com/r/opbeans/opbeans-java" \
org.label-schema.vcs-url="https://github.com/elastic/opbeans-java" \
org.label-schema.license="MIT"
CMD java $JAVA_OPTS –javaagent:elastic-apm-agent-1.19.0.jar -Dspring.profiles.active=${OPBEANS_JAVA_PROFILE:-}\
-Dserver.port=${OPBEANS_SERVER_PORT:-}\
-Dserver.address=${OPBEANS_SERVER_ADDRESS:-0.0.0.0}\
-Dspring.datasource.url=${DATABASE_URL:-}\
-Dspring.datasource.driverClassName=${DATABASE_DRIVER:-}\
-Dspring.jpa.database=${DATABASE_DIALECT:-}\
-jar /app/opbeans-0.0.1-SNAPSHOT.jar
when i try to deploy it i get the following error:
"Error: Could not find or load main class -javaagent:.app.elastic-apm-agent-1.19.0.jar Caused by: java.lang.ClassNotFoundException: -javaagent:.app.elastic-apm-agent-1.19.0.jar"
I am sure I have the elastic-apm-agent-1.19.0.jar file in the same path where I have the Dockerfile when I create the image. I am also sure that the file is copied inside the /app path of the pod because when testing the image without the -javaagent parameter I could visualize the paths of the pod and the jar file was there.
Could you help me?
thanks in advance