Can't get data from php agent inside a container

Kibana version: 7.17.5

Elasticsearch version: 7.17.5

APM Server version: 7.17.5

APM Agent language and version: 1.6.2

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Curl from "https://github.com/elastic/apm-agent-php/releases/download/v1.6.2/apm-agent-php_1.6.2_all.deb

Fresh install or upgraded from other version? fresh

Is there anything special in your setup? the apm-server is installed as a service in the host, and the agent is installed on docker
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): No data has been received from agents yet.

deleted and prune all older images and containers, docker-compose build, and docker-compose up.

message in container build:

Preparing to unpack /tmp/apm-agent-php.deb ...
Unpacking apm-agent-php (1.6.2) ...
Setting up apm-agent-php (1.6.2) ...
Installing Elastic PHP agent
DEBUG: after-install parameter is 'configure'
Detected PHP version '8.1'
Creating /opt/elastic/apm-agent-php/etc/elastic-apm.ini
; ***** DO NOT EDIT THIS FILE *****
; THIS IS AN AUTO-GENERATED FILE by the Elastic PHP agent post-install.sh script
; To overwrite the INI settings for this extension, edit
; the INI file in this directory "/opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini"
[elastic]
extension=/opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php
; END OF AUTO-GENERATED by the Elastic PHP agent post-install.sh script
/opt/elastic/apm-agent-php/etc/elastic-apm.ini created
Configuring elastic-apm.ini for supported SAPI's
Found SAPI config directory: /usr/local/etc/php/conf.d
Linking /opt/elastic/apm-agent-php/etc/elastic-apm.ini to /usr/local/etc/php/conf.d/98-elastic-apm.ini
Linking /opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini to /usr/local/etc/php/conf.d/99-elastic-apm-custom.ini
Extension enabled successfully for Elastic PHP agent
Removing intermediate container 468d9bba87ee
 ---> 71b1c79e5d5b

Successfully built 71b1c79e5d5b
Successfully tagged elastic-apm_php:latest

APM server shows up in kibana

This is my docker-compose.yml

version: '3'
services:
  elasticsearch:
    image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.5'
    container_name: elasticsearch
    environment:
      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - './elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml'
      - './volume/elasticsearch:/usr/share/elasticsearch/data'
    ports:
      - '9200:9200'
    networks:
      - elastic
  kibana:
    image: 'docker.elastic.co/kibana/kibana:7.17.5'
    container_name: kibana
    ports:
      - '5601:5601'
    environment:
      ELASTICSEARCH_URL: 'http://elasticsearch:9200'
      ELASTICSEARCH_HOSTS: 'http://elasticsearch:9200'
    networks:
      - elastic
  web:
    image: 'nginx:latest'
    container_name: nginx
    ports:
      - '8089:80'
    volumes:
      - './nginx.conf:/etc/nginx/conf.d/nginx.conf'
      - './app:/app'
  php:
    build:
      context: .
      dockerfile: PHP.Dockerfile
    container_name:  php
    volumes:
      - './app:/app'
  mysql:
    image: 'mariadb:latest'
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: root
      MYSQL_DATABASE: world
    volumes:
      - 'mysqldata:/var/lib/mysql'
      - './world.sql:/docker-entrypoint-initdb.d/world.sql'
    ports:
      - '3306:3306'
volumes:
  mysqldata:

networks:
  elastic:
    driver: bridge

And the docker file:

FROM php:fpm
RUN docker-php-ext-install pdo pdo_mysql
RUN pecl install xdebug && docker-php-ext-enable xdebug

RUN apt-get -y update
RUN apt-get update && apt-get install -y procps
RUN apt-get install -y git libcurl4-openssl-dev
RUN curl -L "https://github.com/elastic/apm-agent-php/releases/download/v1.6.2/apm-agent-php_1.6.2_all.deb" > /tmp/apm-agent-php.deb && \
  dpkg -i /tmp/apm-agent-php.deb && \
  rm /tmp/apm-agent-php.deb

Hi.

Do you also set some php.ini files to communicate the data to the APM server?

elastic_apm.server_url="http://link-to-apm-server-or-container.ext:port"
elastic_apm.secret_token="Your uber secret token"
elastic_apm.service_name="Name of Application"
elastic_apm.environment="staging"

There is also an APM container needed to receive the data. Do you have to running also?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.