Elasticsearch container won't start

After restarting my Seafile Docker setup, the Elasticsearch container will no longer start - it goes in a restart loop because of:

java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/share/elasticsearch/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes/0/node.lock
java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/share/elasticsearch/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

I’ve tried deleting the file that’s mounted as /usr/share/elasticsearch/data/nodes/0/node.lock, but it doesn’t make any difference! I’v also checked that after stopping the Docker services there are no other Java processes running.

I noticed all Elasticsearch files are owned by user 101 - is that correct?

Any ideas on how to resolve this?

I managed to fix this by changing ownership of the folder mounted to /usr/share/elasticsearch/data, setting the user to the default Elasticsearch container user (UID 1000)[0], e.g.

chown -R 1000:0 /opt/seafile-elasticsearch/data/

[0] /elastic/elasticsearch/blob/master/distribution/docker/src/docker/Dockerfile#L184 (I can’t include links, but this is a github link!)