Answer the question
In order to leave comments, you need to log in
How to correctly create "manually", if at all, a Symfony var directory that lives in a Docker container?
The point is this. There is a Docker image, on the basis of which we create a Docker container and build a Symfony project in it using Composer. Everything is successfully created, assembled and launched locally via "composer install" (the container is created by a separate command, of course) in your console - in particular, the script "cache:clear": "symfony-cmd" is launched, which creates the directory for us var , which creates everything that is needed for the framework to work.
However, when we build the same project in production, we do not run anything ourselves in the console, but we run "composer install --no-dev --no-interaction --no-scripts" in the Dockerfile, and we do not create a var directory (scripts from "scripts" section: "auto-scripts" from composer.json were not run).
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: 172.0.0.1, server: , request: "GET /testing/logging HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "localhost:8080"
Answer the question
In order to leave comments, you need to log in
Run the necessary scripts in the entrypoint, it is possible with a lock-file if you need to execute them once.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question