Score:1

Cannot build a working docker image for an openldap service

cn flag

I'm new to docker and I'm doing a little bit of experimenting with it.

I was trying to create a docker image for an openldap service. I tried creating the image starting from debian:latest image provided from the official docker repos.

This is the content of my Dockerfile

FROM debian
RUN DEBIAN_FRONTEND="noninteractive" apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install --yes --no-install-recommends slapd ldap-utils
RUN apt-get clean

I tried to create a container based on this image with

docker container run --interactive --tty --name=prova image

here image is the name of the image build from the Dockerfile above. When I try to run slapd with service slapd start I get the following error:

[614.896012] Out of memory: Killed process 4005 (slapd) total-vm: 795276KB, anon-rss:334664KB, file-rss:8KB, shmem-rss:0kB, UID:101, pgtables:1108kB, oom_score_adj:0 

So it seems to be a kernel error, due to explosion of the process inside the memory, though I cannot understand what causes it, the same ldap service works fine in the host system or in kvm virtual machines I created.
I've also tried to install openldap inside a live container created from the debian:latest image, I get the same error.

So here's my question: can anyone explain what is going on here and what it's causing the error? Thanks for your help.

Score:1
us flag

Running service slapd start inside a docker container will probably waste some resources, in you case memory, since it needs to run the initd and some shell processes, thus triggering oom-killer quicker than single process container.

You can check the Dockerfile from a well used openldap docker image [1], which runs slapd process directly.

If you are preparing an image for production use, you should also think about Backups and TLS, which are supported by osixia/docker-openldap [1] and docker-openldap-backup [2]

[1] https://github.com/osixia/docker-openldap

[2] https://github.com/osixia/docker-openldap-backup

cn flag
Thanks a lot. Actually reading in osixia's repo I find out a reference describing the problem, apparently it has to do with the ulimit for file descriptor for the slapd daemon. That helped for finding a solution.
Score:1
jp flag

You have an out of memory error and your process is being killed by the kernel. The process allocated a mere 334664KB of RSS, you need to increase your memory limits.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.