How to run composer as non root user on official docker php image How to run composer as non root user on official docker php image docker docker

How to run composer as non root user on official docker php image


Incase anyone wants to achieve the same follow instructions below

I added a USER in dockerfile so that composer will be run as user deploy in future. But php-fpm needs to be run as root. So I set a setuid bit on the php-fpm binary. And now everything got resolved.

RUN chmod u+s /usr/sbin/php-fpm7USER deployENTRYPOINT ["/entrypoint.sh"]CMD ["php-fpm7","-F"]