Having var/cache and var/sessions mounted from the host to the container is causing a lot loading time. How could I ignore these directories so I wouldn't need to wait for var directory on my machine and container being synced?
version: "3"
volumes:
var:
vendor:
services:
php:
container_name: grozissaviems_php
build:
context: docker/php
args:
ENV: ${ENV}
APP: symfony
volumes:
- .:/var/www/html:delegated
- var:/var/www/html/var
- vendor:/var/www/html/vendor
- ./logs/symfony:/var/www/html/var/logs
nginx:
container_name: grozissaviems_nginx
build:
context: docker/nginx
args:
ENV: ${ENV}
ports:
- 5000:80
volumes:
- .:/var/www/html:delegated
- var:/var/www/html/var
- vendor:/var/www/html/vendor
- ./logs/nginx:/var/log/nginx
command: "nginx"
After running container if I enter I get an error for cache permissions being incorrect.
If I launch a script to give var/* permissions
docker exec -it grozissaviems_php bash -c 'mkdir -p var/cache var/logs var/sessions'
docker exec -it grozissaviems_php bash -c 'chmod -R 777 var/cache var/logs var/sessions'
now for some reason page is loaded (with a broken layout, but no error), but in dev.log I get:
cache.WARNING: Failed to save key "%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D" (array) {"key":"%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D","type":"array","exception":"[object] (ErrorException(code: 0): rename(/var/www/html/var/cache/dev/pools/zjgXxX8mSM/5ed64142f0b543.18899510,/var/www/html/var/cache/dev/pools/zjgXxX8mSM/J/P/W1NfrOIzF1l75zOKFhaN): No such file or directory at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php:93)"} []
Is there something wrong with my docker-compose.yml? Is there something I missed?
docker execare not right, try with absolute path instead of relative and see what happens - AppyGG