Skip to content

Elasticsearch 5 won't start if data directory is owned by root, or not created #33

@orangejulius

Description

@orangejulius

The ES5 Docker images run Elasticsearch as a non-root user. This is a good thing, however it means it's difficult to ensure proper permissions for the data directory.

All our other containers (the importers) mount the data directory itself, and then create a subdirectory within it which ensures proper permissions as long as they can write to the data directory, which must already exist. However, the Elasticsearch container mounts $DATA_DIR/elasticsearch. If this directory doesn't exist, Docker will create it, but owned by root. This means Elasticsearch can't write to it, and will fail to start.

Some ideas for solutions:

  • put a mkdir -p $DATA_DIR/elasticsearch inside the pelias script as part of pelias elastic start. This would help ensure non-root permissions are set on the elasticsearch data dir
  • Add mkdir -p $DATA_DIR/elasticsearch to our setup documentation.
  • Mount the root data dir as other containers, modify our Elasticsearch Docker image to run a setup script that creates needed directories as a non-root user, and modify elasticsearch.yml to look for data in the right place

Of those, I prefer the first: it's pretty simple, and requires no action on the part of our users. However, adding more required functionality into the pelias script is not ideal, since we'd like to keep it as thin of a wrapper as possible.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions