In my Spring Boot App Yaml I have :
management:
metrics:
export:
simple:
enabled: true
endpoints:
web:
exposure:
include: "*"
However, when i hit
localhost:8080/actuator/metrics
its working in spring boot standalone app, but in the docker image the endpoint actuator/metrics doesnt work and it redirect me to the default page, the app still works fine.
My docker file :
FROM openjdk:11-jre-buster
RUN apt update && apt install curl -y
&& rm -rf /var/lib/apt/lists/*
MAINTAINER xxxxx
ARG VERSION
ENV SERVER_PORT 80
ENV JAVA_OPTS -Xmx1g
# add this to solve buster sso issue
ENV OPENSSL_CONF=/etc/ssl
ENV SPRINGPROFILES=actuator
WORKDIR /app
COPY maven/docker-package/ /app
# Tesseract installation
RUN apt-get install apt-transport-https &&
echo "deb [trusted=yes] https://notesalexp.org/tesseract-ocr/buster/ buster main" >> /etc/apt/sources.list &&
apt-get update -oAcquire::AllowInsecureRepositories=true &&
apt-get install notesalexp-keyring -oAcquire::AllowInsecureRepositories=true &&
apt-get update &&
apt-get -y install tesseract-ocr
EXPOSE ${SERVER_PORT}
HEALTHCHECK --interval=5s --timeout=5s --retries=3
CMD curl -f http://localhost:80/actuator/health || exit 1
ENTRYPOINT ["sh", "/app/docker-entrypoint.sh"]
docker-entrypoint.sh :
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dlicense.path=/app/licenses/ "-Dspring.profiles.active=${SPRINGPROFILES}" -Dlogging.config=/app/config/log4j2.xml -Dserver.port=80 -jar /app/app-executable.jar
what am i missing? is there any configuration needs to be done to expose the metrics in docker ? thanks for your responses.
question from:
https://stackoverflow.com/questions/65933736/spring-boot-actuator-metrics-endpoint-not-working-in-docker-image 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…