Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Permission denied - /usr/share/logstash/sincedb/sincedb

I have a docker-compose file for running several containers including Logstash. I have mapped the mounted sincedb as in the snippet:

logstash:
build:
  context: logstash/
volumes:      
  - ./tmp/logstash/sincedb:/usr/share/logstash/sincedb

The Logstash container has some permission errors, in particular with accessing sincedb as shown in the error snippet below:

Error: Permission denied - /usr/share/logstash/sincedb/sincedb
Exception: Errno::EACCES

I tried to execute within the container chmod but I get some the errors below:

bash-4.2$ chmod o+wx /usr/share/logstash/sincedb/
chmod: changing permissions of ‘/usr/share/logstash/sincedb/’: Operation not permitted

Is there a way to overcome this permission issue ?

like image 654
SyCode Avatar asked Jan 01 '26 13:01

SyCode


1 Answers

I was able to resolve the issue by setting proper permissions to the host folder, which maps to the folder in the docker container. By issuing the command chmod -R 757 against the folder, access was possible. However, this was a temporary measure, I later discovered the correct permissions can be set in the docker-compose.yml file by appending :rw at the end of the specific line, like so :

 volumes:
  - logstash_data:/usr/share/logstash/sincedb:rw

This effectively maintained the permissions across rebuilds, which is a limitation of the earlier mentioned method (additional to the security implications)

like image 109
SyCode Avatar answered Jan 03 '26 13:01

SyCode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!