---
title: "Compose the stack"
description: "Define the Docker Compose project for Aerospike, the Elasticsearch connector, and Elasticsearch."
---

# Compose the stack

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

Now that you have both configuration files ready, combine them into a Docker Compose stack.

::: caution
This stack is for local development only. Elasticsearch security is disabled, the Elasticsearch connector listens on unencrypted HTTP, and ports `8902` and `9200` are bound to the host loopback interface. Do not remove the `127.0.0.1` host bindings or expose this compose file on an untrusted network.
:::

1.  Create `docker-compose.yml` in the project directory. This file defines the three services that make up the dispute-search pipeline locally: Aerospike Database, the Elasticsearch connector, and Elasticsearch. A fourth `aerospike-tools` container lets you simulate authorization-service writes with `aql`. The `volumes` entries mount the `aerospike.conf` and `aerospike-elasticsearch-outbound.yml` files you created earlier into their respective containers. On startup, the Aerospike Database and Elasticsearch connector images use these configuration files instead of their default settings.
    
    docker-compose.yml
    
    ```yaml
    name: aerospike-elastic-quickstart
    
    services:
    
        aerospike:
    
            image: aerospike/aerospike-server-enterprise:8.1.1.0
    
            container_name: aerospike
    
            volumes:
    
                - ./aerospike.conf:/etc/aerospike/aerospike.template.conf:ro
    
                - ./features.conf:/etc/aerospike/features.conf:ro
    
            healthcheck:
    
                test: ["CMD", "asinfo", "-v", "status"]
    
                interval: 5s
    
                timeout: 5s
    
                retries: 10
    
        elasticsearch:
    
            image: docker.elastic.co/elasticsearch/elasticsearch:9.5.0
    
            container_name: elasticsearch
    
            environment:
    
                - discovery.type=single-node
    
                - xpack.security.enabled=false
    
                - ES_JAVA_OPTS=-Xms512m -Xmx512m
    
            ports:
    
                - "127.0.0.1:9200:9200"
    
            healthcheck:
    
                test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health >/dev/null"]
    
                interval: 5s
    
                timeout: 5s
    
                retries: 20
    
        aerospike-elasticsearch-outbound:
    
            image: aerospike/aerospike-elasticsearch-outbound:3.0.2
    
            container_name: aerospike-elasticsearch-outbound
    
            volumes:
    
                - ./aerospike-elasticsearch-outbound.yml:/etc/aerospike-elasticsearch-outbound/aerospike-elasticsearch-outbound.yml:ro
    
            ports:
    
                - "127.0.0.1:8902:8902"
    
            depends_on:
    
                aerospike:
    
                    condition: service_healthy
    
                elasticsearch:
    
                    condition: service_healthy
    
        aerospike-tools:
    
            image: aerospike/aerospike-tools:13.0.1
    
            container_name: aerospike-tools
    
            depends_on:
    
                aerospike:
    
                    condition: service_healthy
    
            entrypoint: ["sleep", "infinity"]
    ```
    
    The connector’s `depends_on` health checks make it wait for both Aerospike and Elasticsearch, so it never tries to ship a dispute record before Elasticsearch can index it.
    
2.  Validate the Compose file.
    
    Terminal
    
    ```bash
    docker compose config --quiet
    ```
    
    The command exits without output when the file is valid. `aerospike.conf` mounts to `/etc/aerospike/aerospike.template.conf`, not `/etc/aerospike/aerospike.conf`, because the Aerospike image renders the template into its final configuration file at startup. `aerospike-elasticsearch-outbound.yml` mounts directly to the path the Elasticsearch connector reads on startup, with no rendering step.
    

::: undefined
-   I’ve created docker-compose.yml for the tutorial stack.
:::

[Previous  
Configure Aerospike and the Elasticsearch connector](https://aerospike.com/docs/connectors/elasticsearch/learn/get-started/step/1/part/1/aerospike-and-connector) [Next  
Start and verify](https://aerospike.com/docs/connectors/elasticsearch/learn/get-started/step/2/part/1/start-and-verify)