# Apm-server config in docker compose with ES and Kibana

**URL:** <https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227>\
**Category:** APM\
**Tags:** docker, server\
**Created:** [March 31, 2022, 4:52pm UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227 "2022-03-31T16:52:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raushan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raushan/32/102180_2.png) [@Raushan](https://discuss.elastic.co/u/Raushan)\
**Post date:** [March 31, 2022, 4:52pm UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227/1 "2022-03-31T16:52:41Z")

</div>

**Kibana version** : 8.0.0

**Elasticsearch version** : 8.0.0

**APM Server version** : 8.0.0

**APM Agent language and version** : Java 1.28.0

**Browser version** : Chrome

**Original install method (e.g. download page, yum, deb, from source, etc.) and version** : Downloaded from elastic

**Fresh install or upgraded from other version?** Fresh

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.NO

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)** :

I'm trying to install the Elastic APM with Elasticsearch, Kibana and the APM server as 3 services with docker-compose. The file should look like this:

```auto
version: "2.2"

services:

  setup:
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
  
  es01:
    depends_on:
      setup:
        condition: service_healthy
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    volumes:
      - certs:/usr/share/elasticsearch/config/certs
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - ${ES_PORT}:9200
    environment:
      - node.name=es01
      - cluster.name=${CLUSTER_NAME}
      - cluster.initial_master_nodes=es01
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
      - bootstrap.memory_lock=true
     #xpack security
    mem_limit: ${MEM_LIMIT}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",
        ]
      interval: 10s
      timeout: 10s
      retries: 120

  apm-server:
    image: docker.elastic.co/apm/apm-server:8.0.0
    cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"]
    cap_drop: ["ALL"]
    ports:
      - 8200:8200
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E setup.kibana.host=kibana:5601
        -E setup.template.settings.index.number_of_replicas=0
        -E apm-server.kibana.enabled=true
        -E apm-server.kibana.host=172.29.143.107:5601
        -E apm-server.kibana.username=elastic
        -E apm-server.kibana.password=elastic
        -E output.elasticsearch.hosts=["172.29.143.107:9200"] # ["es01:9200"] results the same
        -E output.elasticsearch.username=elastic
        -E output.elasticsearch.password=elastic
    healthcheck:
      interval: 10s
      retries: 12
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/

volumes:
  certs:
    driver: local
  esdata01:
    driver: local
  kibanadata:
    driver: local

```

Docker container starts but **apm-server test output** fails when running inside APM container.

[![enter image description here](https://i.stack.imgur.com/jONsL.png)](https://i.stack.imgur.com/jONsL.png)

Elasticsearch and kibana are ruuning fine.

> <https://stackoverflow.com/questions/71693867/apm-server-configuration-in-docker-compose-with-elasticsearch-and-kibana>

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [March 31, 2022, 5:39pm UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227/2 "2022-03-31T17:39:28Z")

</div>

`apm-server test output` from within the container will need the same configuration you're passing into `apm-server` via the `command`. Two options for you:

1. Move the configuration to `apm-server.yml` and bind mount it into the docker container as directed in [Run APM Server on Docker | APM Server Reference [7.15] | Elastic](https://www.elastic.co/guide/en/apm/server/current/running-on-docker.html#_volume_mounted_configuration)

2. Run the output test with same params: `apm-server test output -E output.elasticsearch.hosts=["172.29.143.107:9200"] -E output.elasticsearch.username=elastic -E output.elasticsearch.password=elastic`

I would also recommend updating to the latest release, version 8.1.2 as of today.

---

<div class="post-metadata">

**Author:** ![Raushan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raushan/32/102180_2.png) [@Raushan](https://discuss.elastic.co/u/Raushan)\
**Post date:** [April 1, 2022, 10:08am UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227/3 "2022-04-01T10:08:30Z")

</div>

As per this [Common problems | APM Server Reference [7.15] | Elastic](https://www.elastic.co/guide/en/apm/server/current/common-problems.html), it doesn't suggest to add ES params. May be doc need to be corrected? or this may not for k8s

By the way, now I'm getting this with the second approach

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e0b78fd01a8e03cafb4315bf3dc0bc0004733c7a.png)

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [April 4, 2022, 1:06am UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227/4 "2022-04-04T01:06:27Z")

</div>

That's a fair point about the docs.

> [@Raushan](#):
>
> now I'm getting this with the second approach

I'm glad to see the progress. Now it seems some plumbing is in order as the curl indicates the Elasticsearch host configured isn't responding.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 24, 2022, 9:07pm UTC](https://discuss.elastic.co/t/apm-server-config-in-docker-compose-with-es-and-kibana/301227/5 "2022-04-24T21:07:23Z")

</div>

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