Need some help with building a docker container


This is a long convoluted question so I’ll try to be brief. I’ve implemented Authelia and tried including all the bells and whistles – redis, mysql, and openldap. I actually have the entire setup working but I’m working on fine tuning.

The docker container for openldap I’m using is this: osixia/openldap

I’ve mounted volumes to this container however the container writes to the volumes with UID and GID 999. Honestly its confusing to me since ldap has reserved UID/GIDs of 439 (

So on the osixia/openldap github, they address this situation with:

The default uid and gid used by the image may map to surprising counterparts in the host. If you need to match uid and gid in the container and in the host, you can use build parameters LDAP_OPENLDAP_UID and LDAP_OPENLDAP_GID to set uid and gid explicitly:

docker build --build-arg LDAP_OPENLDAP_GID=1234 --build-arg LDAP_OPENLDAP_UID=2345 -t my_ldap_image .
docker run --name my_ldap_container -d my_ldap_image
# this should output uid=2345(openldap) gid=1234(openldap) groups=1234(openldap)
docker exec my_ldap_container id openldap

So my question is – how do I do a docker build to implement these instructions?