# How to upgrade ElasticSearch In \`docker-compose.yml\`

**URL:** <https://discuss.elastic.co/t/how-to-upgrade-elasticsearch-in-docker-compose-yml/301408>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [April 3, 2022, 1:29am UTC](https://discuss.elastic.co/t/how-to-upgrade-elasticsearch-in-docker-compose-yml/301408 "2022-04-03T01:29:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![linghengqian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/linghengqian/32/103651_2.png) [@linghengqian](https://discuss.elastic.co/u/linghengqian)\
**Post date:** [April 3, 2022, 1:29am UTC](https://discuss.elastic.co/t/how-to-upgrade-elasticsearch-in-docker-compose-yml/301408/1 "2022-04-03T01:29:01Z")

</div>

- According to [Upgrade Elasticsearch | Elastic Installation and Upgrade Guide [8.1] | Elastic](https://www.elastic.co/guide/en/elastic-stack/current/upgrading-elasticsearch.html) , if I wish to update the `ElasticSearch` instance started within `docker-compose.yml`, do I just need to stop all The insert data works, change the version of the image in `docker-compose.yml`, then `docker compose pull`, `docker compose up -d` two steps, the merge and upgrade of `/usr/share/elasticsearch/data` and `/usr/share/elasticsearch/config` in volumes does not need me to deal with it?

- Suppose such a `docker-compose.yml` file exists. I would like to switch the image from `elastic/elasticsearch:8.1.1-amd64` to `elastic/elasticsearch:8.1.2-amd64`, or just change the `environment`, but I'm not sure if I only need to do the above steps, The steps of official website for the documentation look complicated.

- At the moment I see that it seems that all I need is to change the image version of `kibana`, and then use `bin/elasticsearch-create-enrollment-token -s kibana` in the cluster to generate a registration token for `kibana`.

- Hope someone can provide some hints.

```nohighlight
version: "3.8"
services:
  elasticsearch-node01:
    image: elastic/elasticsearch:8.1.1-amd64
    environment:
      ES_SETTING_BOOTSTRAP_MEMORY__LOCK: true
      ES_SETTING_CLUSTER_NAME: "test-elasticsearch"
      ELASTIC_PASSWORD: "A84D1234-1234-A123-8B12-0FADA1234567"
      ES_JAVA_OPTS: "-Xms4g -Xmx4g"
    volumes:
      - elasticsearch-data01:/usr/share/elasticsearch/data
      - elasticsearch-config01:/usr/share/elasticsearch/config:rw
    ports:
      - "9200:9200"
      - "9300:9300"
    ulimits:
      memlock:
        soft: -1
        hard: -1
 kibana-node01:
    image: elastic/kibana:8.1.1
    ports:
      - "5601:5601"
    volumes:
      - kibana-data01:/usr/share/kibana/data
volumes:
  elasticsearch-data01:
    driver: local
  elasticsearch-config01:
    driver: local
 kibana-data01:
    driver: local

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 4, 2022, 12:52am UTC](https://discuss.elastic.co/t/how-to-upgrade-elasticsearch-in-docker-compose-yml/301408/2 "2022-04-04T00:52:51Z")

</div>

If Kibana is registered with Elasticsearch and everything works with 8.1.1, then you only need to change

> [@linghengqian](#):
>
> ```auto
> image: elastic/kibana:8.1.1
> 
> ```

> [@linghengqian](#):
>
> ```auto
> image: elastic/elasticsearch:8.1.1-amd64
> 
> ```

to `image: elastic/kibana:8.1.2` and `image: elastic/elasticsearch:8.1.2-amd64`. Elasticsearch and Kibana will handle any upgrades it might need to do internally.

---

<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:** [May 2, 2022, 12:53am UTC](https://discuss.elastic.co/t/how-to-upgrade-elasticsearch-in-docker-compose-yml/301408/3 "2022-05-02T00:53:00Z")

</div>

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