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

前端 未结 6 904
不知归路
不知归路 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:04

    You could try using the dockerize tool. With that you could wrap the httpd-foreground command and redirect its log files to stdout/stderr (don't know exactly the httpd log file paths, simply adjust them to your needs):

    CMD ["dockerize", "-stdout", "/var/log/httpd.log", "-stderr", "/var/log/httpd.err", "httpd-foreground"]
    

    In addition to that you could grab that containers stdout/stderr then by specifying a syslog log driver and redirect them to the /var/log/syslog log file on the docker host:

    docker run -d --log-driver=syslog ...
    

提交回复
热议问题