Hello, I am running Docker on OS X Monterey, and starting up a vanilla alpine:latest Linux image. I only installed build-base and lmdb-dev and ran /bin/sh as root.
LMDB version (Alpine): lmdb-dev-0.9.33-r0
Inside the container, I wrote this test code:
/* test_open.c */ #include <stdio.h> #include "lmdb.h"
#define DEFAULT_MAPSIZE 1UL<<40
int main() { int rc; MDB_env *env;
rc = mdb_env_create(&env); printf ("env create: %d\n", rc);
rc = mdb_env_set_maxdbs (env, 10); printf ("env set maxdbs: %d\n", rc); rc = mdb_env_set_mapsize (env, DEFAULT_MAPSIZE); printf ("env set mapsize: %d\n", rc);
rc = mdb_env_open (env, "/tmp", 0, 0640); printf ("env open: %d\n", rc);
mdb_env_close (env); return rc; }
I compiled with `gcc test_open.c -llmdb -o test_open` and ran as root, and got this output:
env create: 0 env set maxdbs: 0 env set mapsize: 0 env open: 38
The lock file was created, not the data file.
This only occurs in the guest setup. On the OS X host and on a native Linux host it exits with 0.
Any hints?
stefano@cossu.cc wrote:
Hello, I am running Docker on OS X Monterey, and starting up a vanilla alpine:latest Linux image. I only installed build-base and lmdb-dev and ran /bin/sh as root.
LMDB version (Alpine): lmdb-dev-0.9.33-r0
Inside the container, I wrote this test code:
I compiled with `gcc test_open.c -llmdb -o test_open` and ran as root, and got this output:
env create: 0 env set maxdbs: 0 env set mapsize: 0 env open: 38
The lock file was created, not the data file.
This only occurs in the guest setup. On the OS X host and on a native Linux host it exits with 0.
Any hints?
Most likely, the default filesystem in your docker image doesn't support mmap().
Looks like the problem was an amd64 image built on an aarch64 host. Building with the same architecture resolved the problem.
Thanks for the tip. s
On 2026-03-20 12:35, Howard Chu wrote:
stefano@cossu.cc wrote:
Hello, I am running Docker on OS X Monterey, and starting up a vanilla alpine:latest Linux image. I only installed build-base and lmdb-dev and ran /bin/sh as root.
LMDB version (Alpine): lmdb-dev-0.9.33-r0
Inside the container, I wrote this test code:
I compiled with `gcc test_open.c -llmdb -o test_open` and ran as root, and got this output:
env create: 0 env set maxdbs: 0 env set mapsize: 0 env open: 38
The lock file was created, not the data file.
This only occurs in the guest setup. On the OS X host and on a native Linux host it exits with 0.
Any hints?
Most likely, the default filesystem in your docker image doesn't support mmap().
openldap-technical@openldap.org