K
K
knowledge2019-09-23 10:42:50
PHP
knowledge, 2019-09-23 10:42:50

How to run php-fpm in docker not as root?

I use a ready-made assembly of phpdocker.io with nginx and php-fpm
But the question is also relevant for any independent assembly
When entering the php-fpm container, all files are created from root (in particular, in symfony via bin/console make)
I tried to prescribe in docker-compose in the environment section, php_fpm_user variables, files in the container have rights from the exposed user, but when created from the container, they are still created as root . Tried to
pass the user through the file /phpdocker/php-fpm/pool.d/www.conf user = www-data group = www-data but the situation is the same

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Derepko, 2019-09-23
@xEpozZ

https://stackoverflow.com/questions/32397496/docke...

P
planc, 2019-09-23
@planc

desktop dka # docker run -u www-data -it --rm debian bash
[email protected]:/$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)

desktop dka # docker exec -it -u www-data 8c4f2230c6d3 bash
[email protected]:/$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)

K
knowledge, 2019-09-23
@knowledge

In general, the phpdocker assembly is configured this way, I myself assembled the assembly from images, registered the user in the php-fpm dockerfile and everything is created from him in the container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question