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.
- nginx using /var/www/html serve static files.
- php-fpm using /var/www/html execute php files.
i'm not sure problem. how can sure following:
- /var/www/html have readable nginx ?
- /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
Post a Comment