You can deploy and run AppDynamics App Agents inside Docker containers with no additional configuration. You can also use orchestration frameworks such as Kubernetes and Ansible to set up containers with the desired agents.
Before You Start
Note the following:
- AppDynamics recommends that you use Docker CE/EE v17.03 (or higher) or Docker Engine v1.13 (or higher).
- Before you deploy an agent, review the Best Practices for Configuring App Agents in Containers (below).
Use an Official AppDynamics Image
The quickest and easiest way to run a container with an App Agent installed is to use one of the official AppDynamics Images from the Docker Store. These images are produced by AppDynamics and based on certified base images from the Docker community. You can run these images directly or use them as base images for your own application containers.
If you prefer to build your base images, you can use the full source code on GitHub as a pattern for your own builds: https://github.com/Appdynamics/appdynamics-docker-images.
Best Practices for Configuring App Agents in Containers
You should set the following properties for App Agents running in containers. See Java Agent Configuration Properties for details of how to configure these properties.
- Reuse Node Name and Reuse Node Name Prefix – With these settings specified, the Controller reuses the node name after a container is shut down and marked as historical. See the Configuring the Agent for Dynamic Environments section.
- Agent Runtime Dir – The runtime directory where the agent stores agent logs and config files. This can be a shared volume (Docker) or persistent storage (Kubernetes), mounted into the container. Specifying a runtime directory outside the container ensures that agent logs are accessible after the container is stopped.
- Mark Node Name as Historical – This setting is important to ensure that an agent does not keep consuming a license after the node shuts down. See the Marking Dynamic Nodes as Historical at Shutdown section.
Example: Run the Java Agent using Docker from the Command Line
Redirecting Agent Output to Stdout
It is normally best practice to have all logging output redirected to stdout in containerized environments. To redirect the output of the AppDynamics APM agent to stdout, edit the log4j.xml configuration file and add the following line: