This repository was archived by the owner on Apr 12, 2022. It is now read-only.
This repository was archived by the owner on Apr 12, 2022. It is now read-only.
Entrypoint needs to chown data directory #90
Closed
Description
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_dir
exec 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
.
Metadata
Metadata
Assignees
Labels
No labels