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

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

    I adjusted config, as from the Dockerfile recipe of httpd, they use sed to adjust the config, to change ErrorLog and CustomLog as follows:

    sed -ri ' \
    s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
    s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
    ' /usr/local/apache2/conf/httpd.conf \
    

    See https://github.com/docker-library/httpd/blob/master/2.4/Dockerfile (towards the end of the file)

提交回复
热议问题