The bottom line is this. There is a Docker image based on which we create the Docker container and collect it in a Symfony project using Composer. All of the succeeds is going to run on a LAN via "composer install" (the container is created as a separate command, of course) in the console - in particular, a script is run "cache:clear": "symfony-cmd" which creates a var directory in which to create everything that you need to work the framework.
However, when we collect the same project in prod, we don't run yourself in the console, however, run "composer install --no-dev --no-interaction --no-scripts" in the Dockerfile, and we have not created the var directory (the scripts from the section "scripts": "auto-scripts" from the composer.json was not running). As a result, when you try to work with the project, we get something like:
2020/01/01 00:00:01 [error] 10#10: ... Uncaught Warning: file_put_contents(/www_root/var/cache/dev/srcBlah_KernelDevDebugContainerDeprecations.log): failed to open stream: No such file or directory" while reading upstream, client: 220.127.116.11, server: , request: "GET /testing/logging HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "localhost:8080"
Question: how to solve it? It is clear that the easiest way is to add in a Dockerfile something like "RUN mkdir -p-m777 /www/var", but not any taken community a more native way to create this directory, or even to change anything in Docker image or frameworks to this directory created automatically?