How does one use Apache in a Docker Container and write nothing to disk (all logs to STDIO / STDERR)?

前端 未结 6 903
不知归路
不知归路 2021-02-13 12:18

I\'m running Apache2 in a docker container and want to write nothing to the disk, writing logs to stdout and stderr. I\'ve seen a few different ways to do this (Supervisord and

6条回答
  •  迷失自我
    2021-02-13 13:02

    I'm not positive that this won't mess with httpd's logging at all (e.g. if it tries to seek within the file), but you can set up symlinks from the log paths to /dev/stdout and /dev/stderr, like so:

    ln -sf /dev/stdout /path/to/access.log
    ln -sf /dev/stderr /path/to/error.log
    

    The entry command to the vanilla httpd container from Docker Hub could be made to be something like

    ln -sf /dev/stdout /path/to/access.log && ln -sf /dev/stderr /path/to/error.log && /path/to/httpd
    

提交回复
热议问题