Closed nezamy closed 4 years ago
It seems that the local folder mounted contain too many files, and exceeded the maximum # of files that the auto-reloading program (inotify) allows. You can run following command to check the limit:
docker run --rm -t phpswoole/swoole cat /proc/sys/fs/inotify/max_user_watches
You can increase the limit by updating file /proc/sys/fs/inotify/max_user_watches
in the Docker container.
I tried to edit the file but I got this
echo 999999999999 > /proc/sys/fs/inotify/max_user_watches
bash: /proc/sys/fs/inotify/max_user_watches: Read-only file system
Is there any other way to work with Docker in development
Sorry my previous answer was wrong. To increase the limit, we need to update fs.inotify.max_user_watches
on the host but not in the Docker container, since the container will just transparently share whatever is set on the host.
On Linux, we can set a new limit temporarily with following commands with sudo
or use the root account:
sysctl fs.inotify.max_user_watches=999999
sysctl -p
On MacOS, it requires more steps than on Linux:
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
.sysctl
commands mentioned previously.Ctrl-a
d
or Ctrl-a
Ctrl-d
to detach from the screen session.Now we can run command docker run --rm -t phpswoole/swoole cat /proc/sys/fs/inotify/max_user_watches
to see if the limit has been successfully changed or not. Please note that I tested it on MacOS only; ideally it should work for Linux as well.
I didn't try to make the changes permanently; if interested, please check GitLab page Increasing the amount of inotify watchers for more information.
I'm using the auto-reload example and I get this after a few changes in files