osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.04k stars 975 forks source link

slapd fails to start - daemon: listen(ldap://ldap, 5) failed errno=98 (Address already in use) #198

Open macgregor opened 6 years ago

macgregor commented 6 years ago

Been working on this all afternoon, Im hoping I have something obviously misconfigured. I got it to work once and then on a restart I get this error when slapd tries to start and I havent been able to make it go away except by manual intervention.

version: '2.0'
services:
    ldap:
        image: osixia/openldap:1.2.0
        container_name: openldap
        restart: always
        command: --loglevel trace --copy-service
        volumes:
          - ./ldap/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom
          - ./ldap/slapd/database:/var/lib/ldap
          - ./ldap/slapd/config:/etc/ldap/slapd.d
        environment:
          LDAP_ADMIN_PASSWORD: "admin"
          LDAP_ORGANISATION: "Redhat Inc."
          LDAP_DOMAIN: "redhat.com"
          LDAP_TLS: "false"
          LDAP_TLS_ENFORCE: "false"
          LDAP_TLS_VERIFY_CLIENT: "never"
          LDAP_REMOVE_CONFIG_AFTER_SETUP: "false"
          LDAP_BACKEND: "hdb"
        hostname: ldap.redhat.com
        ports:
          -  "127.0.0.1:389:389"
          -  "127.0.0.1:636:636"

openldap_slapd_failed_to_start_1_debug.txt openldap_slapd_failed_to_start_2_trace.txt openldap_slapd_failed_to_start_3_trace_manual_start.txt openldap_slapd_failed_to_start_4_docker_info.txt

Things I've tried:

What am I doing wrong?

BertrandGouny commented 6 years ago

The issue seems to come from container hostname. I will investigate on that.

Thanks for reporting this issue.

macgregor commented 6 years ago

yeah looks like if I remove hostname altogether it works

claudio-vellage commented 6 years ago

I‘m having the same problem, but in my case removing the hostname doesn’t resolve the issue, but leads to another issue, that slapd can’t bind to the desired address.

I‘m running the container with an existing LDAP database and config from a previous installation. If I run a shell inside the container and start the slapd service manually, there is no problem and I can query the LDAP.

claudio-vellage commented 6 years ago

Can’t edit my previous comment, since I’m on mobile, but the error suddenly disappeared.

maheshjc commented 6 years ago

Anyone got this to work? I cannot get it work even after removing host name.

hpwxf commented 6 years ago

I confirm that I have the same problem when I'm using a fully qualified hostname or a domainname (but ok, with a simple hostname like 'ldap' without any domainname).

LeonardoRivillini commented 5 years ago

I have the same problem.. and I could see that in my /etc/hosts had two lines for the same hostname. I put all in one line and works!

thanks men!

marknaero commented 5 years ago

I also ran into this problem only when specifying a docker config domainname.

I was able to workaround this by overwriting the entrypoint to specify the arg to not mess with the /etc/hosts file, i.e:


ENTRYPOINT ["/container/tool/run", "--dont-touch-etc-hosts"]

Options are here: https://github.com/osixia/docker-light-baseimage/blob/807519dc9ec668f3df8ebe5d273e7f1ec4b9fa2b/image/tool/run#L841

ghost commented 4 years ago

Hi - I commented domainname and hostname and got it working.