You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2022. It is now read-only.
The Dockerfile chowns various directories, including the data directory, but this is a bit nonsensical since nobody runs the image in production with the default data directory; the chown doesn't work with a volume mapping. Specifically, under Kubernetes, with a persistent volume claim (e.g. via a statefulset), the volume mounted is owned by root.
The idiomatic way of handling this is to let the entrypoint run as root, ensure the directory permissions, then drop privileges:
mkdir -p $data_dir
chown elasticsearch $data_dir
chmod 0755 $data_direxec su-exec elasticsearch bin/elasticsearch # or gosu or whatever
The only way to do this from Kubernetes without modifying the official image is with an init container, which should be unnecessary, and is obviously potentially brittle since it'd need to chown using the numerical UID that's hard-coded in this Dockerfile.