docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

Add User 1000 to www-data with php-apache image #1420

Closed huyhoang8398 closed 1 year ago

huyhoang8398 commented 1 year ago

Im using php-apache image. Do I still need to add user 1000 to www-data and chown all the /var/www/html to www-data

RUN usermod -u 1000 www-data
...
RUN chown -R www-data:www-data /var/www/html

Or maybe in docker compose with this ENV:

environment:
   - APACHE_RUN_USER="#1000"
   - APACHE_RUN_GROUP="#1000"

Or just leave it as default? but i chroot to the container and see all files is own by root:root

tianon commented 1 year ago

Honestly, you're probably even be better off running with --user 1000:1000 (or user: '1000:1000' in docker-compose.yml), if you've got a new enough kernel/Docker to support Apache running unprivileged and binding to port 80 (but barring that, what you've described should work).