OCR-D / ocrd_all

Master repository which includes most other OCR-D repositories as submodules
MIT License
71 stars 18 forks source link

Docker: Logfile permissions problems #426

Open joschrew opened 5 months ago

joschrew commented 5 months ago

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'
decadance-dance commented 5 months ago

The same issue here.

mikegerber commented 4 months ago

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).

mikegerber commented 4 months ago

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?