symfony - How to deal with permissions using docker - nginx / php-fpm -


i'm trying deploy simple symfony application using nginx & php-fpm via docker.

two docker services :
1. web : running nginx
2. php : running php-fpm; containing application source.

i want build images can deployed without external dependency. that's why i'm copying source code within php container.
on development process; i'm overriding /var/www/html volume local path.

# file: php-fpm/dockerfile php:7.1-fpm-alpine  copy ./vendor /var/www/html copy . /var/www/html  volume /var/www/html 

now docker-compose configuration file.

# file : docker-compose-prod.yml version: '2' services:   web:     image: "private/web"     ports:       - 80:80     volumes_from:       - php   php:     image: "private/php"     ports:       - 9000:9000 

the problem permissions.
when accessing localhost, symfony botting up, cache / logs / sessions folders not writable.

  1. nginx using /var/www/html serve static files.
  2. php-fpm using /var/www/html execute php files.

i'm not sure problem. how can sure following:

  1. /var/www/html have readable nginx ?
  2. /var/www/html have writable php-fpm ?

note: i'm building images macbookpro; cache / logs / sessions 777.

i've found solution; if can explain best practices, appreciate !

folders cache / logs / sessions docker context not empty (on host).
folders have been flushed, symfony creates them permissions.

i've found people using usermod change uid, ie: 1000 www-data / nginx ... seems ugly hack. think ?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -