Docker-openldap: Error with docker-compose

Created on 14 Nov 2017  路  5Comments  路  Source: osixia/docker-openldap

Hi all,

i am able to run smoothly this ldap contanier using docker run cmd line as follow:

docker run -d
   --name ldap 
   -p 389:389  
   --env LDAP_ORGANISATION="ACME Software" 
   --env LDAP_BASE_DN="dc=softdept,dc=acme,dc=int" 
   --env LDAP_DOMAIN="softdept.acme.int" 
   --env LDAP_ADMIN_PASSWORD="password" 
   -v /home/mrx/projects/y/containers/ldap/ldif:
   /container/service/slapd/assets/config/bootstrap/ldif/custom  
   osixia/openldap:1.1.10 
   --copy-service

If i query the ldap with:

docker exec ldap ldapsearch 
   -x 
   -H ldap://localhost 
   -b "dc=softdept,dc=acme,dc=int" 
   -D "cn=admin,dc=softdept,dc=acme,dc=int" 
   -w password

I successfully got the list of the inserted users and groups with ldif files.
When i move to docker-copose with this yaml file:

version: '3'
services:
  ldap:
    image: osixia/openldap:1.1.10
    container_name: ldap
    ports:
      - 389:389
    environment:
      - LDAP_ORGANISATION="ACME Software"
      - LDAP_DOMAIN="softdept.acme.int"
      - LDAP_BASE_DN="dc=softdept,dc=acme,dc=int"
      - LDAP_ADMIN_PASSWORD="password"
    volumes:
      - ./ldap/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom

And i execute the same ldap search above i got this error:

dap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

The only difference I can see is lack of --copy-service flag in docker-compose version which honesty I don't know how to drop in the compose yaml file.
However sounds like a network issue, can you spot the problem?
Thanks a lot
GP

Most helpful comment

Been wrestling with this issue this afternoon and found that the issue is that when you use in docker run --env LDAP_DOMAIN="domain.tld" it works, but when you use - LDAP_DOMAIN="domain.tld" in compose it doesn't.

The issue here are the quotes around the value, in compose they are passed through and then (i think) the internal scripting cant explode it to seperate dc='s. when you add it as - LDAP_DOMAIN=domain.tld it works.

All 5 comments

I have the same issue when building a docker stack. It listens on the localhost on 389 (I can run the ldap search on the container itself) ok but it cannot pass the network barrier. Is the ldap service only listening on localhost by default? And if yes, where to I change that?

You pass in command args with the command:

In your case command: --copy-service

Hey Solnet-phiro, even i am facing same issue as you posted, were you able to solve it, can you please help me out with it. my docker-compose content is below. I am able to do telnet localhost 389, but from outside of the VM its not working

ldapadmin:
image: osixia/openldap
ports:
- "389:389"
- "689:689"
networks:
- goinet
environment:
- LDAP_ORGANISATION="In"
- LDAP_DOMAIN="go.in"
- LDAP_ADMIN_PASSWORD="pasword123"
deploy:
placement:
constraints: [node.role == manager]
command: --loglevel debug

Immidiate help is appreciated

Been wrestling with this issue this afternoon and found that the issue is that when you use in docker run --env LDAP_DOMAIN="domain.tld" it works, but when you use - LDAP_DOMAIN="domain.tld" in compose it doesn't.

The issue here are the quotes around the value, in compose they are passed through and then (i think) the internal scripting cant explode it to seperate dc='s. when you add it as - LDAP_DOMAIN=domain.tld it works.

Been wrestling with this issue this afternoon and found that the issue is that when you use in docker run --env LDAP_DOMAIN="domain.tld" it works, but when you use - LDAP_DOMAIN="domain.tld" in compose it doesn't.

The issue here are the quotes around the value, in compose they are passed through and then (i think) the internal scripting cant explode it to seperate dc='s. when you add it as - LDAP_DOMAIN=domain.tld it works.

I confirm without the quote are the problem !
Thank a lot @ferrymanders !! :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xd34 picture xd34  路  4Comments

LeaklessGfy picture LeaklessGfy  路  4Comments

dalareo picture dalareo  路  5Comments

vadimkim picture vadimkim  路  6Comments

Holt59 picture Holt59  路  4Comments