Solution:
I think your issue with user being used is different, php:7.4-apache
uses www-data
as user. to confirm the user when you run ( replace php:7.4-apache with your image name)
docker run -d php:7.4-apache
and than run
docker exec -it YOUR_IMAGE_HASH ps aux
it should show you www-data
under User columns of running processes. Once you identify the correct user, you can add to your docker file , like
FROM php:7.4-apache
.....
ARG user_id=1000
RUN usermod -u $user_id www-data