If your uid on the host (id -u) isn’t the same as the uid of the user in the docker container (often “docker”) then you can have this problem. You can try:
- Making the UIDs the same between your user and the user in the docker container.
- Setting the group permissions on the directory to be writable for a group that both you and docker belong to.
- You could also use the nuclear option:
chmod a+rwx -R project-dir/
The nuclear option will make your git workspace filthy, which will annoy you greatly, so isn’t the best long-term solution. It stops the bleeding tho.
For further understanding the problem, you might find these useful:
- https://github.com/docker/docker/issues/7906
- https://github.com/docker/docker/issues/7198