Closed mxr576 closed 2 years ago
sounds like php-fpm upstream issue https://github.com/docker-library/php/issues/358#issuecomment-353686172
I do not think that this is actually related to this problem based on the thread. Besides, if I use a Docker image from another vendor then the code above works, the problem is that vendor does not have permission hardening in those images.
If you run echo test > /proc/self/fd/2
as root it won't work either
wodby@php.container:/mnt/files/local_mount/build $ sudo -u root echo test > /proc/self/fd/2
test
Is it? :thinking: (I am using the last PHP 7.3 Drupal image.)
I'm not sure how I checked but it works for me now 🤔 as I understand ownership for /proc/self/fd/*
set according to the default user (or specified via --user
) of the container, thus FPM (run from www-data
user) shouldn't have any permissions issues because it run from wodby via sudo by default.
So I try to reproduce your original issue:
$ docker run --rm -ti wodby/drupal-php sh
wodby@php.container:/var/www/html $ drush eval "file_put_contents('/dev/stdout', 'foo', FILE_APPEND);"
foowodby@php.container:/var/www/html $
wodby@php.container:/var/www/html $ ls -la /dev/stdout
lrwxrwxrwx 1 root root 15 Oct 7 11:43 /dev/stdout -> /proc/self/fd/1
wodby@php.container:/var/www/html $ ls -la /proc/self/fd/2
lrwx------ 1 wodby wodby 64 Oct 7 11:43 /proc/self/fd/2 -> /dev/pts/0
yes, /dev/stdout
owned by root but with 777
permissions and /proc/self/fd/1
owned by default user (wodby
). Maybe you run containers with root
defaut user then su
to wodby
, idk 🤷🏻♂️
I tried several different ways (
/dev/stdout
,php://stdout
,/proc/self/fd/2
, etc...) but I have always got a similar error like this:I guess it happens because PHP-FPM runs as
www-data
butSo it does not have permission to write to the stream.
A similar issue: https://github.com/thecodingmachine/docker-images-php/pull/139