Frappe docker bench init failed due to permission error

Just followed the steps frappe_docker/development at main · frappe/frappe_docker · GitHub

after login into the container and bench init, there is always this permission error both in ubuntu 18.04 and centos 7.9

docker exec -e “TERM=xterm-256color” -w /workspace/development -it devcontainer_frappe_1 bash

it is very strange that in my office on an ubuntu 20.04 server the same steps worked without any issue.

workaround solution
run this command in the container
sudo chown -R frappe .

Anyone can help to find the root cause and final solution.


Why the sites folder owner is an unknown user 1001? maybe this is the cause of the error, but how to fix this?

still workaround solution, run command on host machine
sudo chmod -R a+rwx /var/lib/docker/volumes/

User uid/gid is 1001 on machines on which frappe doesn’t work. May be you have 2 users in those machines and logged in as user with uid gid 1001

Login as user with uid gid 1000

Or, exec inside container change ownership of sites directory chown -R frappe:frappe .

Or if you want to manually change permission of docker volumes first list and inspect docker volumes to find its location on docker host machine. Then you can use sudo chown -R 1000:1000 ... instead of chmod -R a+rwx ...


Many thanks as always.