Skip to content

Elasticsearch Volume Mapping error #1

@mstabile75

Description

@mstabile75

Elasticsearch requires special permissions on the host machine when volume mapping the data directory. It is possible to have docker force this permission change as descibed below which is an exert from this Elasticsearch Doc

By default, Elasticsearch runs inside the container as user elasticsearch using uid:gid 1000:1000.

Caution
One exception is Openshift which runs containers using an arbitrarily assigned user ID. Openshift will present persistent volumes with the gid set to 0 which will work without any adjustments.

If you are bind-mounting a local directory or file, ensure it is readable by this user, while the data and log dirs additionally require write access. A good strategy is to grant group access to gid 1000 or 0 for the local directory. As an example, to prepare a local directory for storing data through a bind-mount:

mkdir esdatadir
chmod g+rwx esdatadir
chgrp 1000 esdatadir

As a last resort, you can also force the container to mutate the ownership of any bind-mounts used for the data and log dirs through the environment variable TAKE_FILE_OWNERSHIP; in this case they will be owned by uid:gid 1000:0 providing read/write access to the Elasticsearch process as required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions