appdynamics/java-agent

Verified Publisher

By AppDynamics

Updated about 1 month ago

Java Agent for Kubernetes

Image
Integration & delivery
Monitoring & observability
15

10M+

appdynamics/java-agent repository overview

Using the AppDynamics Java Agent Docker Image

This document explains how to use the AppDynamics Docker image from Docker Hub: https://hub.docker.com/r/appdynamics/java-agent.

Important Note: This Docker image is specifically designed to deliver the AppDynamics Java Agent binaries. Customers are strongly advised NOT to use this image as a base image for their application containers.

Purpose of the Image

This Docker image primarily serves as a delivery mechanism for the AppDynamics Java Agent binaries to be copied into your application's Docker container.

How to Use

To integrate the AppDynamics Java Agent into your application container, you should copy the contents of /opt/appdynamics from this image into your application's image. Here are two recommended methods:

1. With Init Containers (Kubernetes/OpenShift)

For container orchestration platforms like Kubernetes or OpenShift, an init container is an excellent way to stage the agent files. The init container runs to completion before your main application container starts, copying the necessary files.

Example Kubernetes Snippet:

---
initContainers:
  - name: appd-agent
    image: appdynamics/java-agent:latest
    command:
      - cp
      - -r
      - /opt/appdynamics/.
      - /opt/appdynamics-java
    volumeMounts:
      - name: appd-agent-repo
        mountPath: /opt/appdynamics-java
containers:
  - name: my-java-app
    image: my-java-app-image:latest
    volumeMounts:
      - name: appd-agent-repo
        mountPath: /opt/appdynamics-java
    env:
      - name: JAVA_TOOL_OPTIONS
        value: -javaagent:/opt/appdynamics-java/javaagent.jar
volumes:
  - name: appd-agent-repo
    emptyDir: {}

2. As a Builder in Multi-Stage Docker Builds

For standard Docker builds, you can leverage multi-stage builds to copy the agent files efficiently without increasing the size of your final application image.

Example Dockerfile for your Application:

# Stage 1: Get the Agent
FROM appdynamics/java-agent:latest AS appd-agent

# Stage 2: Build your application
FROM openjdk:17-jdk-slim # Your app's base image

# Copy agent from Stage 1
COPY --from=appd-agent /opt/appdynamics /opt/appdynamics

# Enable the agent
ENV JAVA_TOOL_OPTIONS="-javaagent:/opt/appdynamics/javaagent.jar"

# Add your application
WORKDIR /app
COPY target/my-java-app.jar /app/my-java-app.jar
CMD ["java", "-jar", "my-java-app.jar"]

By following these methods, you can effectively integrate the AppDynamics Java Agent into your containerized Java applications while adhering to the recommended best practices for this specific Docker image.

Tag summary

Content type

Image

Digest

sha256:d776ca168

Size

77.4 MB

Last updated

about 1 month ago

docker pull appdynamics/java-agent:26.4.0

This week's pulls

Pulls:

213,828

Last week