ocrd_all
ocrd_all copied to clipboard
Docker: Logfile permissions problems
When I run the ocrd_all docker-image as another user than root initLogging
causes an error when trying to init the processing-server logfile. Because the logfile is already created during the docker image build process it is owned by root. When I start the ocrd_all container as another user, initLogging might be called and raises an error like this:
File "/usr/local/bin/ocrd", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1685, in invoke
super().invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/ocrd/cli/network.py", line 25, in network_cli
initLogging()
File "/usr/local/lib/python3.8/site-packages/ocrd_utils/logging.py", line 181, in initLogging
logging.config.fileConfig(config_file)
File "/usr/lib/python3.8/logging/config.py", line 79, in fileConfig
handlers = _install_handlers(cp, formatters)
File "/usr/lib/python3.8/logging/config.py", line 145, in _install_handlers
h = klass(*args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1147, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python3.8/logging/__init__.py", line 1176, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/tmp/ocrd_processing_server.log'
The same issue here.
Now using docker's --mount type=tmpfs,destination=/tmp
. This may be a problem if any user switching is going on (not only here from root to some other user).
Without knowing anything about processing server: Is a default global file-writable logfile a good idea? If this were optional, user could enable one of their choosing? How about workspace-local or syslog/journal?