docker - 在 Docker 中安装 GCP Profiler 代理时遇到问题

标签 docker google-cloud-platform stackdriver google-cloud-profiler

我正在尝试为我在 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/

相关文章:

docker - 内存快照 docker

nginx - docker 组成 : volumes and user

google-cloud-platform - 将 MQL 与 Google Cloud Monitoring (Stackdriver) 警报策略结合使用

docker - Stackdriver Log Agent - 与用于 Docker 的 Google Cloud Logging 驱动程序无关的日志级别

google-cloud-platform - 为 Google Cloud Functions 创建开发和暂存环境

google-cloud-platform - Stackdriver:监控可用磁盘空间

docker - Docker容器以非零退出状态退出

php - 使用 bookworm 在 Docker 中为 PHP8.1 添加 Memcached 支持时出现问题

java - Google Dataflow Beam 作业中的 SSL 握手异常

google-cloud-platform - 需要帮助来构建 Cloud Datastore 数据对象