我正在尝试为我在 GKE 中运行的应用程序安装 GCP Profiler 代理,请遵循此处的说明:https://cloud.google.com/profiler/docs/profiling-java
我无法克服这个错误。有人可以帮忙吗?
Could not find agent library /opt/cprof/profiler_java_agent.so in absolute path, with error: Error relocating /opt/cprof/profiler_java_agent.so: __pthread_key_create: initial-exec TLS resolves to dynamic definition in /opt/cprof/profiler_java_agent.so
这是 Dockerfile
FROM openjdk:8-jdk-alpine
RUN apk update && apk add --no-cache gcompat
RUN apk update && apk add --no-cache libc6-compat
WORKDIR /app
# The application's jar file
ARG JAR_FILE=target/example-svc-*.jar
# Add the application's jar to the container
ADD ${JAR_FILE} example-svc.jar
EXPOSE 5050
RUN mkdir -p /opt/cprof && \
wget -q -O- https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz \
| tar xzv -C /opt/cprof
ENTRYPOINT ["java", \
"-agentpath:/opt/cprof/profiler_java_agent.so=-cprof_service=example-svc,-cprof_service_version=0.0.1-SNAPSHOT", \
"-jar", "/app/example-svc.jar"]
最佳答案
问题似乎是您正在使用的容器镜像的基本版本。查看您的 Dockerfile,您将从:
openjdk:8-jdk-alpine
深入研究这个文档,我们发现:
The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements.
(引用:openjdk)
现在,如果我们查看找到的 Google 文档 here ,我们发现定义了以下要求:
Supported operating systems:
- Linux versions whose standard C library is implemented with glibc.
...这似乎是一个冲突。请尝试使用不基于
alpine
的 openjdk 镜像的替代版本.
关于docker - 在 Docker 中安装 GCP Profiler 代理时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59216006/