Enterprise Search - Docker Compose example

Here is a simple way to start Enterprise Search (App Search and Workplace Search) with docker-compose.

Write the following in your docker-compose.yml file:

---
version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:$ELASTIC_VERSION
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - cluster.routing.allocation.disk.threshold_enabled=false
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD
      - xpack.security.enabled=true
      - xpack.security.authc.api_key.enabled=true
      - xpack.license.self_generated.type=trial
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks: ['stack']

  enterprisesearch:
    image: docker.elastic.co/enterprise-search/enterprise-search:$ELASTIC_VERSION
    environment:
    - "ent_search.auth.source=standard"
    - "elasticsearch.username=elastic"
    - "elasticsearch.password=$ELASTIC_PASSWORD"
    - "elasticsearch.host=http://elasticsearch:9200"
    - "allow_es_settings_modification=true"
    - "secret_management.encryption_keys=[XYZ]"
    - "ENT_SEARCH_DEFAULT_PASSWORD=$ELASTIC_PASSWORD"
    ports: ['3002:3002']
    networks: ['stack']
    links: ['elasticsearch']
    depends_on: ['elasticsearch']

networks:
  stack: {}

.env file is:

ELASTIC_VERSION=7.8.0
ELASTIC_PASSWORD=changeme

Once started, you can open http://localhost:3002 and connect with enterprise_search / changeme account.