Running Redash on M1 Mac on Docker
· Bit of a pain in the assI had some issues running Redash on an M1 Mac. Running Redash using Docker should be an easy ride. But not on the M1 Mac.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/app/robusta/utils/directory_watcher.py", line 47, in watch
observer.start()
File "/usr/local/lib/python3.8/site-packages/watchdog/observers/api.py", line 256, in start
emitter.start()
File "/usr/local/lib/python3.8/site-packages/watchdog/utils/__init__.py", line 93, in start
self.on_thread_start()
File "/usr/local/lib/python3.8/site-packages/watchdog/observers/inotify.py", line 118, in on_thread_start
self._inotify = InotifyBuffer(path, self.watch.is_recursive)
File "/usr/local/lib/python3.8/site-packages/watchdog/observers/inotify_buffer.py", line 35, in __init__
self._inotify = Inotify(path, recursive)
File "/usr/local/lib/python3.8/site-packages/watchdog/observers/inotify_c.py", line 155, in __init__
Inotify._raise_error()
File "/usr/local/lib/python3.8/site-packages/watchdog/observers/inotify_c.py", line 405, in _raise_error
raise OSError(err, os.strerror(err))
OSError: [Errno 38] Function not implemented
inotify, QEMU, Docker
This issue is caused by a limitation in QEMU.1 The easy solution is to navigate in the cloned repository to bin/docker-entrypoint
2 and replace the following:
dev_scheduler() {
echo "Starting dev RQ scheduler..."
exec watchmedo auto-restart --directory=./redash/ --pattern=*.py --recursive -- ./manage.py rq scheduler
}
With:
dev_scheduler() {
echo "Starting dev RQ scheduler..."
exec ./manage.py rq scheduler
}
And also replace:
dev_worker() {
echo "Starting dev RQ worker..."
exec watchmedo auto-restart --directory=./redash/ --pattern=*.py --recursive -- ./manage.py rq worker $QUEUES
}
With the following:
dev_worker() {
echo "Starting dev RQ worker..."
exec ./manage.py rq worker $QUEUES
}
This removes the watchmedo
binary. The downside is that the daemons will not restart on changes in the Redash source code.
Source for image: Verge
-
In Docker desktop preview, the inotify function fails on a container with platform set to linux/AMD64. GitHub. (n.d.). Retrieved January 2, 2022, from https://github.com/docker/for-mac/issues/5321
The current workaround is to switch to ARM64 images and avoid x86 images. According to the Docker docs (which link to this very issue), inotify doesn’t work when emulating x86.