Help APM APM for Python Install DataExporter and Python agent in a Docker

Installing S247DataExporter and the Python agent in a Docker container (same container)

Follow the steps below to install S247DataExporter and the Python agent in a Docker container:

  1. Install the APM Insight Python package in the Dockerfile and set your Python application name using the APM_APP_NAME environment variable.
  2. Add the S247DataExporter install command with install arguments in the Dockerfile.
  3. Start the S247DataExporter and your Python application by passing it as an argument to the apminsight-run command in the entrypoint script file.

An example Dockerfile

FROM python:3.9
#
# Your code
#
# Prerequisite (ignore if already installed)
RUN apt-get update && apt-get install -y wget unzip procps curl
# Set your license key and appplication name to be shown in site24x7 apm client
ENV S247_LICENSE_KEY="license-key"
ENV APM_APP_NAME="Python-Application"

# installing the Python agent pip3 install -U apminsight
# installing the S247DataExporter (This is mandatory for the Python agent to work)
RUN wget -O InstallDataExporter.sh https://staticdownloads.site24x7.com/apminsight/S247DataExporter/linux/InstallDataExporter.sh
RUN sh InstallDataExporter.sh -root -nsvc
# Entrypoint script
COPY ./example-entrypoint.sh /example-entrypoint.sh
ENTRYPOINT [ "sh","/example-entrypoint.sh" ]

An example entrypoint script

#!/bin/sh
# Start S247DataExporter
sh /opt/S247DataExporter/bin/service.sh start
# Pass your application start command to the apminsight-run script
apminsight-run <user application execute command> 

By default, the Python application uses 20021 and 20022 for the status port and data port, respectively. If you want to update them, you can set the values as environment variables using the following keys:

  • Status port - AGENT_STATUS_PORT
  • Data port - AGENT_DATA_PORT


Related articles

How to install various APM Insight agents in a Docker container
Java | .NET | PHP | Node.js

How to install various APM Insight agents in a Kubernetes environment
Java | .NET | PHP | Node.js | Python

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help APM APM for Python Install DataExporter and Python agent in a Docker