Should log files go to a volume?
BeginnerScenarioVolumes, storage and data
Answer
Situation read → Apps writing to /var/log/app.log inside the container.
What I'd do → Log to stdout/stderr so Docker's logging driver collects them. For legacy apps symlink /var/log/app.log to /dev/stdout as the nginx image does.
Why → Works with docker logs, centralized shippers and rotation, with no volume to clean.
Interview tip → Twelve-factor: treat logs as event streams.
More on Volumes, storage and data
A Postgres container was removed and the data is gone. How should it have been run?BeginnerBind mount or named volume for local development of a Node app?BeginnerHow do you back up a named volume?IntermediateTwo containers must share files. What are your options?BeginnerA container needs a writable temp area but the root filesystem is read-only.IntermediateMoving a database volume from one Docker host to another.Intermediate