Hello 👋
I have a problem running Opensearch on Railway. I would like to mount a volume on /usr/share/opensearch/data but, since the volume is mounted as root, Opensearch can't use it and I get errors. I tried to add RAILWAY_RUN_UID=0 as stated on Railway docs but Opensearch won't run as root :/
OpenSearch cannot run as root. Please start your container as another user.
Thanks for any help 🙂
#Volume permissions
11 messages · Page 1 of 1 (latest)
Project ID: 188bf912-f6d5-473b-a04c-28fcc7d44154
188bf912-f6d5-473b-a04c-28fcc7d44154
As a workaround I used this start command but I'm not sure if it's suitable in a production environment 😦
bash -c "yum install -y sudo && chown -R 1000:1000 /usr/share/opensearch && sudo -E -u opensearch bash -c 'export PATH=$PATH:/usr/share/opensearch/bin && ./opensearch-docker-entrypoint.sh'"
New reply sent from Help Station thread:
Best practice is to do this in the dockerfile doing something like this
FROM opensearchproject/opensearch:latest USER root RUN chown -R 1000:1000 /usr/share/opensearch USER 1000 CMD ["./ opensearch-docker-entrypoint.sh "]according to some articles I saw online. Let me know if this helps!
You're seeing this because this thread has been automatically linked to the Help Station thread.
New reply sent from Help Station thread:
Volumes aren't available during build, so chowning the folder at build won't do too much.
You're seeing this because this thread has been automatically linked to the Help Station thread.
New reply sent from Help Station thread:
Oh really? Well crap thats not ideal...
You're seeing this because this thread has been automatically linked to the Help Station thread.
New reply sent from Help Station thread:
So would his solution be best?
You're seeing this because this thread has been automatically linked to the Help Station thread.
New reply sent from Help Station thread:
Something like this will likely needed to be done -
https://github.com/railwayapp-templates/elasticsearch
You're seeing this because this thread has been automatically linked to the Help Station thread.
I can't do this since opensearch container doesn't come with sudo installed. That's why i install it in the start command in my workaround :/
So looks like my solution wasn't "just" a workaround ?
New reply sent from Help Station thread:
Take a peek at this as it looks to be doing something similar.
https://github.com/railwayapp-templates/elasticsearch/blob/main/Dockerfile
You're seeing this because this thread has been automatically linked to the Help Station thread.