I am following the below article in Ubuntu environment.
https://github.com/osixia/docker-openldap
Step:1
Pull the image with container name mycompanyname-container
docker run -p 389:389 -p 689:689 --name mycompanyname-container --detach osixia/openldap:1.2.2
Step2:
Then I search for default details which is working fine.
docker exec mycompanyname-container ldapsearch -x -H ldap://localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
Step:3
Now i create a new server with below details which is created successfully but once i ran the search command in step 4 then it is throwing error.
docker run --env LDAP_ORGANISATION="My Company" --env LDAP_DOMAIN="my-company.com" \
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.2.2
Step:4
Once i ran the below command to search new server details it through the below error.
docker exec mycompanyname-container ldapsearch -x -H ldap://my-company.com -b dc=my-company,dc=com -D "cn=admin,dc=my-company,dc=com" -w JonSn0w
Error message
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
it is throwing the above error message please let me know is there any config setting required?
I'm having the same issue and am interested to find out the issue
I've had the same issue when using environment variables via docker-compose. However, using a yaml file in a folder and then adding as a volume works fine.
This would be the contents of say /data/ldap/environment/env.yaml
LDAP_ORGANISASTION: My Company
LDAP_DOMAIN: my-company.com
LDAP_ADMIN_PASSWORD: JonSn0w
then roughly follow https://github.com/osixia/docker-openldap#link-environment-file
so add --volume /data/ldap/environment:/container/environment/01-custom to your docker run command.
Personally I'm using docker-compose, so I'd add the following in the relevant section
volumes:
- /data/ldap/environment:/container/environment/01-custom
Not sure if this helps, but for the record I ran into a similar issue via docker-compose, and for me what saved the day was to move from this YML syntax:
environment:
- LDAP_ORGANISASTION=My Company
- LDAP_DOMAIN=my-company.com
- LDAP_ADMIN_PASSWORD=JonSn0w
to this one:
environment:
LDAP_ORGANISASTION: "My Company"
LDAP_DOMAIN: "my-company.com"
LDAP_ADMIN_PASSWORD: "JonSn0w"
Hope this helps
The problem is that you are using -H ldap://my-company.com but my-company.com does not resolve properly within the container same command with -H ldap://localhost works like a charm
Please also look into https://github.com/osixia/docker-openldap/issues/252 which might also explain your issue
Most helpful comment
Not sure if this helps, but for the record I ran into a similar issue via
docker-compose, and for me what saved the day was to move from this YML syntax:to this one:
Hope this helps