When attempting to run Flower in a Docker container using the provided Dockerfile, the container fails on startup. I get the following stack trace:
Traceback (most recent call last):
File "/usr/local/bin/flower", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/flower/__main__.py", line 11, in main
flower.execute_from_commandline()
File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 281, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/usr/local/lib/python3.6/site-packages/flower/command.py", line 59, in handle_argv
return self.run_from_argv(prog_name, argv)
File "/usr/local/lib/python3.6/site-packages/flower/command.py", line 43, in run_from_argv
flower = Flower(capp=self.app, options=options, **settings)
File "/usr/local/lib/python3.6/site-packages/flower/app.py", line 42, in __init__
max_tasks_in_memory=self.options.max_tasks)
File "/usr/local/lib/python3.6/site-packages/flower/events.py", line 77, in __init__
state = shelve.open(self.db)
File "/usr/local/lib/python3.6/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
return mod.open(file, flag, mode)
_gdbm.error: [Errno 13] Permission denied
I figured this was because the flower process was running with restricted access privileges. When I remove the following line in the Dockerfile, it works without any issues:
USER nobody
The same error is returned with --persistent=True
@fropert : Is there a solution for this error with the persistent=True flag ?
@fropert solution is update https://github.com/mher/flower/blob/master/Dockerfile#L18 and stop using nobody user, because it does not have system permissions to create files, such a flower.db.
Fixed by https://github.com/mher/flower/commit/d0aa4e53236bc4a796ebfb96edabb61e5d72adec#diff-3254677a7917c6c01f55212f86c57fbf
I am still getting the same issue with the latest version
I am still getting the same issue with the latest version
command: ["flower", "--broker=redis://:seismic@redis:6379/0", "--basic_auth=petrec:seismic", "--port=5555", "--persistent=True"]
_gdbm.error: [Errno 13] Permission denied: 'flower'
Most helpful comment
@fropert solution is update https://github.com/mher/flower/blob/master/Dockerfile#L18 and stop using
nobodyuser, because it does not have system permissions to create files, such aflower.db.