# Aliases are lost after Elasticsearch Docker container recreate

**URL:** <https://discuss.elastic.co/t/aliases-are-lost-after-elasticsearch-docker-container-recreate/340743>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [August 14, 2023, 10:43am UTC](https://discuss.elastic.co/t/aliases-are-lost-after-elasticsearch-docker-container-recreate/340743 "2023-08-14T10:43:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxim\_Dubrovin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maxim_dubrovin/32/124595_2.png) [@Maxim\_Dubrovin](https://discuss.elastic.co/u/Maxim_Dubrovin)\
**Post date:** [August 14, 2023, 10:43am UTC](https://discuss.elastic.co/t/aliases-are-lost-after-elasticsearch-docker-container-recreate/340743/1 "2023-08-14T10:43:56Z")

</div>

Hello. Our project have Elasticsearch and Logstash running as Docker containers. Both started with one "docker-compose up" command. Containers config in "docker-compose.yaml" file. Elasticsearch successfully persists data using "volumes" option.

Sometimes we need to recreate Elasticsearch container (debug, maintenance or docker-compose.yaml changes). Indexes data is still here (volumes working). But Aliases to all indexes are lost.

My questions:

1. Aliases don't have persistent storage as indexes?
2. After container recreate is it ok aliases are cleared?

docker-compose.yaml

```auto
version: "3"
services:
  elasticsearch:
    image: elasticsearch:8.0.0
    container_name: sem_elasticsearch
    environment:
      - ELASTIC_PASSWORD=<ELASTIC_PASSWORD>
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=true
      - cluster.routing.allocation.disk.threshold_enabled=true
      - cluster.routing.allocation.disk.watermark.low=5gb
      - cluster.routing.allocation.disk.watermark.high=2gb
      - cluster.routing.allocation.disk.watermark.flood_stage=1gb
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - ./elasticsearch/config/hunspell:/usr/share/elasticsearch/config/hunspell:ro
      - ./volumes/elasticsearch:/var/lib/elasticsearch/data

  logstash:
    build:
      context: .
      dockerfile: Dockerfile-logstash
    container_name: sem_logstash
    depends_on:
      - elasticsearch
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
      - ELASTIC_USER=elastic
      - ELASTIC_PASSWORD=<ELASTIC_PASSWORD>
      - DB_URL=<DB_URL
      - DB_USER=logstash
      - DB_PASSWORD=<DB_PASSWORD>
      - xpack.monitoring.enabled=false
    volumes:
      - ./logstash/pipeline/:/usr/share/logstash/pipeline/:ro
      - ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
      - ./logstash/config/queries/:/usr/share/logstash/config/queries/:ro

```

---

<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:** [September 11, 2023, 10:44am UTC](https://discuss.elastic.co/t/aliases-are-lost-after-elasticsearch-docker-container-recreate/340743/2 "2023-09-11T10:44:53Z")

</div>

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