Docker – Apache shared memory for mod_digest on read-only Docker container

digestdockerhttpd

I am running a docker container using following arguments;

docker run -d \
    -v "$(pwd)/data/logs:/logs" \
    -v "$(pwd)/data/auth:/auth" \
    -v "/mnt/data:/data" \
    -v "$(pwd)/data/dav.config:/usr/local/apache2/conf/dav.conf" \
        --memory="2g" \
        --cpu-shares=1024 \
        --read-only="true" \
        --tmpfs /tmp --tmpfs /run \
    --restart="always" \
    --name dav \
    dav

However, when starting httpd, I get;

[Wed May 11 10:26:32.938887 2016] [auth_digest:notice] [pid 1:tid 139835054438272] AH01757: generating secret for digest authentication ...
[Wed May 11 10:26:32.939164 2016] [auth_digest:error] [pid 1:tid 139835054438272] (30)Read-only file system: AH01762: Failed to create shared memory segment on file /usr/local/apache2/logs/authdigest_shm.1
[Wed May 11 10:26:32.939194 2016] [auth_digest:error] [pid 1:tid 139835054438272] (30)Read-only file system: AH01760: failed to initialize shm - all nonce-count checking, one-time nonces, and MD5-sess algorithm disabled
[Wed May 11 10:26:32.939210 2016] [:emerg] [pid 1:tid 139835054438272] AH00020: Configuration Failed, exiting

I do not know any directives to specifiy the location of /usr/local/apache2/logs/authdigest_shm.1. /run and /tmp are tmpfs, rest is read-only. Any ideas?

Best Answer

Try change DefaultRuntimeDir directive value

The DefaultRuntimeDir directive sets the directory in which the server will create various run-time files (shared memory, locks, etc.). If set as a relative path, the full path will be relative to ServerRoot.

See: https://httpd.apache.org/docs/2.4/mod/core.html#defaultruntimedir