bookkeeper icon indicating copy to clipboard operation
bookkeeper copied to clipboard

Permission denied in the docker image

Open nodece opened this issue 1 year ago • 0 comments

Describe the bug

I tried using the apache/bookkeeper:4.17.1 image to run the local bookie, but an error was thrown:

bookkeeper@5223bdf53e80:/opt/bookkeeper$ bin/bookkeeper localbookie 6
[0.001s][error][logging] Error opening log file '/opt/bookkeeper/logs/gc_165.log': Permission denied
[0.002s][error][logging] Initialization of output 'file=/opt/bookkeeper/logs/gc_%p.log' using options 'filecount=5,filesize=64m' failed.
Invalid -Xlog option '-Xlog:gc=info:file=/opt/bookkeeper/logs/gc_%p.log::filecount=5,filesize=64m', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

To Reproduce

docker run -it --rm apache/bookkeeper:4.17.1 bash

# then run this command in the container

bin/bookkeeper localbookie 6

Additional context

  • Docker default user root

  • Directories info

bookkeeper@5223bdf53e80:/opt/bookkeeper$ ls -l
total 296
-rw-r--r-- 1 bookkeeper bookkeeper  36785 Nov  8  2023 LICENSE
-rw-r--r-- 1 bookkeeper bookkeeper   6567 Nov  8  2023 NOTICE
-rw-r--r-- 1 bookkeeper bookkeeper   2820 Nov  8  2023 README.md
drwxr-xr-x 1 bookkeeper bookkeeper   4096 Nov  8  2023 bin
-rw-r--r-- 1 root       root       181760 Jul  4 16:40 bookkeeper-shell.log
drwxr-xr-x 1 bookkeeper bookkeeper   4096 Nov  8  2023 conf
drwxr-xr-x 1 bookkeeper bookkeeper   4096 Jun 25 14:38 deps
drwxr-xr-x 1 bookkeeper bookkeeper  24576 Jun 25 14:38 lib
drwxr-xr-x 2 root       root         4096 Jul  4 16:40 logs
drwxr-xr-x 1 bookkeeper bookkeeper   4096 Jun 25 14:39 scripts

Suggestion

  1. Using bookkeeper user to run this image
  2. /data, /opt/bookkeeper/logs, /opt/bookkeeper/conf are writeable

I can make a PR to fix this.

nodece avatar Jul 04 '24 17:07 nodece