cache: sharing across containers requires special options
[cache] LMDB error: Resource temporarily unavailable [cache] LMDB error: Resource temporarily unavailable [cache] incompatible cache database detected, purging [cache] reading version returned: -11 [system] interactive mode [00000.00][plan] plan '.' type 'NS' uid [65536.00] [65536.00][iter] '.' type 'NS' new uid was assigned .01, parent uid .00 [cache] LMDB error: Resource temporarily unavailable [65536.01][cach] => exact hit error: -11 Resource temporarily unavailable
Attempt to share cache across two or more Docker containers:
docker run -P -w /tmp/kresd -v /tmp/shared:/tmp/kresd -ti cznic/knot-resolver:v5.1.3
Minimal reproducer without Docker: Run two processes using command
unshare -Up --fork kresd
This is caused by LMDB dependency on unique PID numbers (for reader slots?). This assumption does not hold for Docker containers (because of its use of PID namespaces). LMDB upstream does not seem to care.
Disable PID namespace, i.e. run Docker containers using
docker run --pid=host, which prevents non-unique PIDs among containers.
Alternative is to run additional containers with the same PID namespace as the first container using
docker run --pid=container:name_of_the_first_container, but disadvantage is that exiting the first container will terminate all others as well. I.e. this prevents dynamic instance restarts.