Quick Start: LDAP by Bitnami

Quick Start: LDAP by Bitnami

Prerequisite

OR

Note: If using HTTP, remove the tls: {} in dynamic configuration.

Preparation

compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
services:
ldap:
image: bitnami/openldap
restart: always
environment:
- LDAP_ADMIN_USERNAME=admin
- LDAP_ADMIN_PASSWORD=secret # Change this in production!
- LDAP_ROOT=dc=chaos,dc=io
# For phpLDAPadmin compatibility
- LDAP_PORT_NUMBER=389
- LDAP_LDAPS_PORT_NUMBER=636
volumes:
- openldap:/bitnami/openldap
networks:
- traefik-net

ldapadmin:
image: osixia/phpldapadmin
restart: always
environment:
- PHPLDAPADMIN_LDAP_HOSTS=ldap
# if configure https by traefik, you need to configure the following two lines
# if not, remove them
- VIRTUAL_HOST=ldap.x.internal
- PHPLDAPADMIN_HTTPS=false
networks:
- traefik-net
volumes:
openldap:

networks:
traefik-net:
external: true

Note: In production, use Docker secrets or environment variables for sensitive information like passwords.

ldap.yml in dir dynamic-conf

You should touch ldap.yml in traefik dir dynamic-conf.

For much more information, please reference the Prerequisite.

1
2
3
4
5
6
7
8
9
10
11
12
13
http:
routers:
ldap:
rule: "Host(`ldap.x.internal`)"
service: "ldap"
tls: { }

services:
ldap:
loadBalancer:
servers:
- url: "http://ldapadmin"

DNS Configuration

Configure your DNS or modify your hosts file:

  • For Unix-like systems: Edit /etc/hosts
  • For Windows: Edit C:\Windows\System32\drivers\etc\hosts

Add the following line:

1
127.0.0.1 ldap.x.internal

Run

1
2
3
4
docker compose up -d
# Alternative commands:
# docker compose -p ldap up -d
# docker compose -f ./compose.yml -p ldap up -d

Access: https://ldap.x.internal