Quick start development environmentedit

If you’re just looking for a quick way to try out Elastic APM, you can easily get started with Docker. Just follow the steps below.

Create a docker-compose.yml file

The Elastic Docker registry contains Docker images for all of the products in the Elastic Stack. You can use Docker compose to easily get the default distributions of Elasticsearch, Kibana, and APM Server up and running in Docker.

Create a docker-compose.yml file and copy and paste in the following:

version: '2.2'
services:
  apm-server:
    image: docker.elastic.co/apm/apm-server:7.8.1
    depends_on:
      elasticsearch:
        condition: service_healthy
      kibana:
        condition: service_healthy
    cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"]
    cap_drop: ["ALL"]
    ports:
    - 8200:8200
    networks:
    - elastic
    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=kibana:5601
         -E output.elasticsearch.hosts=["elasticsearch:9200"]
    healthcheck:
      interval: 10s
      retries: 12
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
    - bootstrap.memory_lock=true
    - cluster.name=docker-cluster
    - cluster.routing.allocation.disk.threshold_enabled=false
    - discovery.type=single-node
    - ES_JAVA_OPTS=-XX:UseAVX=2 -Xms1g -Xmx1g
    ulimits:
      memlock:
        hard: -1
        soft: -1
    volumes:
    - esdata:/usr/share/elasticsearch/data
    ports:
    - 9200:9200
    networks:
    - elastic
    healthcheck:
      interval: 20s
      retries: 10
      test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"'

  kibana:
    image: docker.elastic.co/kibana/kibana:7.8.1
    depends_on:
      elasticsearch:
        condition: service_healthy
    environment:
      ELASTICSEARCH_URL: http://elasticsearch:9200
      ELASTICSEARCH_HOSTS: http://elasticsearch:9200
    ports:
    - 5601:5601
    networks:
    - elastic
    healthcheck:
      interval: 10s
      retries: 20
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:5601/api/status

volumes:
  esdata:
    driver: local

networks:
  elastic:
    driver: bridge

Compose

Run docker-compose up. Compose will download the official docker containers and start Elasticsearch, Kibana, and APM Server.

Install Agents

When Compose finishes, navigate to http://localhost:5601/app/kibana#/home/tutorial/apm. Complete steps 4-6 to configure your application to collect and report APM data.

Visualize

Use the APM app at http://localhost:5601/app/apm to visualize your application performance data!

When you’re done, ctrl+c will stop all of the containers.

Advanced Docker usage

If you’re interested in learning more about all of the APM features available, or running the Elastic stack on Docker in a production environment, see the following documentation: