# Moving indices to Docker

**URL:** <https://discuss.elastic.co/t/moving-indices-to-docker/320069>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [November 29, 2022, 4:20pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069 "2022-11-29T16:20:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jozef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jozef/32/100378_2.png) [@Jozef](https://discuss.elastic.co/u/Jozef)\
**Post date:** [November 29, 2022, 4:20pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/1 "2022-11-29T16:20:41Z")

</div>

Hi, I am currently trying to test the overhead a docker container adds to query latency, among other tests requiring a containerized ES. In order to do this I am creating a container and mounting the folder containing the original indices created by a non-dockerized ES instance. The issue I am running into is that ES throws the following error from the docker container.

```auto
java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/share/elasticsearch/data]] with lock id [0]

```

I am currently using docker compose to start the container with the following file:

```auto
version: '2.2'

services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6
    container_name: elasticsearch
    labels:
      - es-env="test-docker"
    healthcheck:
      test: "curl -X GET http://elasticsearch:9200/_cluster/health"
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
    volumes
      - es01-data:/usr/share/elasticsearch/data
    networks:
      - es-network    

  kibana:
    image: docker.elastic.co/kibana/kibana:7.17.6
    container_name: kibana
    labels:
      - es-env="test-docker"
    depends_on:
      elasticsearch:
        condition: service_healthy
    environment:
      ELASTICSEARCH_URL: http://elasticsearch:9200
      ELASTICSEARCH_HOSTS: '["http://elasticsearch:9200"]'
    ports:
      - 5601:5601
    networks:
      - es-network

volumes:
  es01-data:
    driver: local
    driver_opts:
      device: /scratch/es_volume
      type: 'none'
      o: 'bind'

networks:
  es-network:
    name: es-net

```

Am I taking the correct approach by mounting an existing data folder, or is there some clear mistake here? Any suggestions on how to approach this would be welcome, as re-indexing all the data would be prohibitive.  
I have already checked whether there is another java instance holding the locks, and this does not seem to be the case.  
Would I need to manually set the permissions inside the docker container?  
Thanks a lot!

---

<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:** [November 30, 2022, 12:55am UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/2 "2022-11-30T00:55:34Z")

</div>

> [@Jozef](#):
>
> Am I taking the correct approach by mounting an existing data folder

Is the other node outside of docker still running?

---

<div class="post-metadata">

**Author:** ![Jozef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jozef/32/100378_2.png) [@Jozef](https://discuss.elastic.co/u/Jozef)\
**Post date:** [November 30, 2022, 9:48am UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/3 "2022-11-30T09:48:51Z")

</div>

No, it is completely shut down.

---

<div class="post-metadata">

**Author:** ![rory.hunter](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@rory.hunter](https://discuss.elastic.co/u/rory.hunter)\
**Post date:** [December 2, 2022, 12:18pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/4 "2022-12-02T12:18:24Z")

</div>

Is there more to the error message? A stack trace perhaps?

---

<div class="post-metadata">

**Author:** ![Jozef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jozef/32/100378_2.png) [@Jozef](https://discuss.elastic.co/u/Jozef)\
**Post date:** [December 5, 2022, 3:09pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/5 "2022-12-05T15:09:02Z")

</div>

> Is there more to the error message? A stack trace perhaps?

My apologies for the time it took to get back to you, in the end, I simply bit the bullet and used elasticdump to move my incides to the docker instance.  
I now strongly suspect that the issue I ran into before could have been solved by setting the permissions of the original elasticsearch data folder to 1000:root.

---

<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:** [December 5, 2022, 7:56pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/6 "2022-12-05T19:56:09Z")

</div>

> [@Jozef](#):
>
> I now strongly suspect that the issue I ran into before could have been solved by setting the permissions of the original elasticsearch data folder to 1000:root.

Yes, that's more than likely.

---

<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:** [January 2, 2023, 7:56pm UTC](https://discuss.elastic.co/t/moving-indices-to-docker/320069/7 "2023-01-02T19:56:19Z")

</div>

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