Run nginx and php into containers with proper user for development

前端 未结 2 1313
悲哀的现实
悲哀的现实 2021-02-11 09:38

I have installed and configured nginx + php-fpm on their own containers. All working fine except one thing: they\'re running with user www-data (id: 82) and same gr

2条回答
  •  -上瘾入骨i
    2021-02-11 09:58

    User's ID can be changed in the image to map the host user's ID for that purpose.

    Example for php-fpm-alpine:

    RUN apk add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
    

    As nginx runs as root (container's root and host's root) there is no need to manipulate with UIDs

提交回复
热议问题