在docker集装箱的贝加尔许可问题

我在我的覆盆子pi上使用我的贝加尔docker容器的权限有一些奇怪的现象:

当我启动容器时,一切都运行良好,但是如果稍后再检查,我会得到403 Forbidden或500 Internal服务器错误。 如果我检查日志,我看到以下内容:

2017-05-26 06:33:01: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Warning: require(/baikal/vendor/autoload.php): failed to open stream: Permission denied in /baikal/html/ cal.php on line 46 2017-05-26 06:33:01: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Fatal error: require(): Failed opening required '/baikal/vendor/autoload.php' (include_path='.:/usr/shar e/php:/usr/share/pear') in /baikal/html/cal.php on line 46 2017-05-26 06:33:05: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Warning: require(/baikal/vendor/autoload.php): failed to open stream: Permission denied in /baikal/html/ cal.php on line 46 2017-05-26 06:33:05: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Fatal error: require(): Failed opening required '/baikal/vendor/autoload.php' (include_path='.:/usr/shar e/php:/usr/share/pear') in /baikal/html/cal.php on line 46 2017-05-26 06:33:17: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Warning: require(/baikal/vendor/autoload.php): failed to open stream: Permission denied in /baikal/html/ cal.php on line 46 2017-05-26 06:33:17: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Fatal error: require(): Failed opening required '/baikal/vendor/autoload.php' (include_path='.:/usr/shar e/php:/usr/share/pear') in /baikal/html/cal.php on line 46 2017-05-26 06:36:05: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Warning: require_once(/baikal/vendor/composer/autoload_real.php): failed to open stream: Permission deni ed in /baikal/vendor/autoload.php on line 5 2017-05-26 06:36:05: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Fatal error: require_once(): Failed opening required '/baikal/vendor/composer/autoload_real.php' (includ e_path='.:/usr/share/php:/usr/share/pear') in /baikal/vendor/autoload.php on line 5 

我在网上find的大多数权限问题都是缺less权限,但是这些都是从一开始就发生的,而不是一段时间之后。

我做的事情:

  • chown -R lighttpd在容器启动的整个/贝加尔文件夹上
  • 在容器启动的整个/贝加尔文件夹上的chmod -R 755

那时一切正常。

我用find /baikal -not -perm 755recursion地检查了整个文件夹的权限,并且找不到任何文件,所以权限仍然是应该的。

我用su lighttpd将用户切换到lighttpd,并检查是否实际上仍然可以访问该用户应该访问的所有内容,并遵循autoload.php的path,我发现即使尽pipe如此,仍然无法读取composer / autoload_real.php权限设置正确:

 root@fc3ee8c5ea61:/baikal/vendor/composer# ls -l total 56 -rwxr-xr-x 1 lighttpd root 12466 May 24 13:56 ClassLoader.php -rwxr-xr-x 1 lighttpd root 1073 May 24 13:56 LICENSE -rwxr-xr-x 1 lighttpd root 147 May 24 13:56 autoload_classmap.php -rwxr-xr-x 1 lighttpd root 797 May 24 13:56 autoload_files.php -rwxr-xr-x 1 lighttpd root 363 May 24 13:56 autoload_namespaces.php -rwxr-xr-x 1 lighttpd root 733 May 24 13:56 autoload_psr4.php -rwxr-xr-x 1 lighttpd root 1793 May 24 13:56 autoload_real.php -rwxr-xr-x 1 lighttpd root 14102 May 24 13:56 installed.json 

用lighttpd用户:

 $ ls -l ls: cannot access autoload_real.php: Permission denied ls: cannot access ClassLoader.php: Permission denied ls: cannot access autoload_classmap.php: Permission denied ls: cannot access LICENSE: Permission denied ls: cannot access autoload_files.php: Permission denied ls: cannot access autoload_psr4.php: Permission denied ls: cannot access installed.json: Permission denied ls: cannot access autoload_namespaces.php: Permission denied total 0 -????????? ? ? ? ? ? ClassLoader.php -????????? ? ? ? ? ? LICENSE -????????? ? ? ? ? ? autoload_classmap.php -????????? ? ? ? ? ? autoload_files.php -????????? ? ? ? ? ? autoload_namespaces.php -????????? ? ? ? ? ? autoload_psr4.php -????????? ? ? ? ? ? autoload_real.php -????????? ? ? ? ? ? installed.json 

我读过,人们有SELinux干扰的问题,但显然这是没有启用覆盆子pi主机。 尽pipe如此,我已经在卷映射中添加了“:Z”标志来自动设置正确的标签,但是没有解决这个问题。

我最初以为这是apache2行事,所以我切换到lighttpd但面临同样的问题。

另一件事我检查了打开的文件与lsof的数量,认为最大的打击,没有其他文件可以打开,但它并不寻常。

如果我重新启动容器,一切都可以正常工作,所以我认为随着时间的推移,一些东西会发生变化或者积累,导致问题。 有什么奇怪的是,我只有这个与我的贝壳集装箱。 我运行一个单独的容器,在apache2上运行的agendav没有任何问题。

此外,如果我/容器/ bash进入容器,做chmod -R 755 /baikal和没有其他的一切开始工作再次,即使所有的权限表明755被设置。

请注意,权限错误是在/贝加尔/供应商/ ..这不是一个已装入的卷,这些文件复制与复制在Dockerfile中。

我几乎没有想法要寻找什么,没有任何人有任何想法是什么正在进行?