chown 在 docker 容器内无效

chown 在 docker 容器内无效

核心问题
我有一些文件目前归“root”所有:

root@b75277d71d6f:/app/config/jwt# getfacl public.pem
# file: public.pem  
# owner: root  
# group: root  
user::rwx  
group::r-x  
other::r-x   

现在我想更改此文件的所有者(使用 chown):

chown -R application:application public.pem -v  
changed ownership of 'public.pem' from root:root to application:application

看起来不错,对吧?但是再次调用 getfacl 却发现实际上什么都没发生改变:

root@b75277d71d6f:/app/config/jwt# getfacl public.pem
# file: public.pem  
# owner: root  
# group: root  
user::rwx  
group::r-x  
other::r-x   

背景(可能相关): 我正在开展一个 Web 开发项目(Shopware 6),在本地主机上打开网站时出现此错误:

用户通知:密钥文件“file:///app/config/jwt/public.pem”权限不正确,建议更改为 600 或 660,而不是 755

然后我偶然发现另一个用户也遇到了同样的问题。他通过将所有权更改为“应用程序”解决了这个问题(德语链接:https://forum.shopware.com/discussion/comment/255936#Comment_255936. 这就是我最终来到这里的原因。

非常感谢您的帮助:)

编辑: 我发现这个线程有同样的问题:https://askubuntu.com/questions/398767/chown-has-no-effect-even-after-it-claims-it-changed-owner
建议的解决方案是通过 mount 命令更改所有者。遗憾的是,我完全不知道如何实现这一点,因为我对 Linux 和 Docker 还不熟悉。

相关内容