osixia/docker-phpLDAPadmin

Can't contact LDAP server (-1) for user when using openldap

Marketos-Damigos opened this issue · 7 comments

I am getting this error message when I try to login to the server as in #29 :

Unable to connect to LDAP server openldap
Error: Can't contact LDAP server (-1) for user
Failed to Authenticate to server
Invalid Username or Password.

If i use ldapsearch inside the container, using either the env variable or directly specifying openldap:1389 it works perfectly.
I have the following docker-compose file:

  openldap:
    image: bitnami/openldap:2.6-debian-10
    container_name: openldap
    environment:
      PUID: 1000
      PGID: 1000
      LDAP_ALLOW_ANON_BINDING: no
      LDAP_ADMIN_USERNAME: admin
      LDAP_ADMIN_PASSWORD: 
      LDAP_CUSTOM_LDIF_DIR: /ldifs
      LDAP_ROOT: dc=example,dc=com
    restart: always
    networks:
      web:
        ipv4_address: 172.20.0.43
    ports:
      - 1389:1389    
    volumes:
      - ./containers/openldap/ldifs:/ldifs:ro
      - ./containers/openldap/ldap:/bitnami/openldap
    labels:
      - traefik.enable=true
      ## HTTP Routers
      - "traefik.http.routers.openldap-rtr.entrypoints=https"
      - "traefik.http.routers.openldap-rtr.rule=Host(`openldap.$DOMAINNAME_CLOUD_SERVER`)"
      - "traefik.http.routers.openldap-rtr.tls=true"
      ## Middlewares
      # - "traefik.http.routers.wiki-rtr.middlewares=middlewares-oauth@file"
      ## HTTP Services
      - "traefik.http.routers.openldap-rtr.service=openldap-svc"
      - "traefik.http.services.openldap-svc.loadbalancer.server.port=1389"
      - "com.centurylinklabs.watchtower.enable=true"


  phpldapadmin:
    image: osixia/phpldapadmin:latest
    container_name: phpldapadmin
    environment:
      PHPLDAPADMIN_LDAP_HOSTS: "openldap:1389"
      PHPLDAPADMIN_HTTPS: "false"
    ports:
      - "9214:80"
    command: --loglevel=debug
    depends_on:
      - openldap
    networks:
      web:
        ipv4_address: 172.20.0.45
    restart: always
pplmx commented

Hi, @Marketos-Damigos
Do you fix it finally? When I use bitnami/opneldap, I encounter the same issue. ><

You have to set the port to 389 inside the container when using internal docker network. You can do that with

      - LDAP_PORT_NUMBER=389
      - LDAP_LDAPS_PORT_NUMBER=636
pplmx commented

Hi, @baba2k
Thanks for your comment. :)
It works fine.