2017-02-24 11:30:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
NAME=ldap_server
|
|
|
|
docker rm -f $NAME 2>/dev/null
|
|
|
|
|
|
|
|
docker run --env LDAP_ORGANISATION="Harbor." \
|
|
|
|
--env LDAP_DOMAIN="example.com" \
|
|
|
|
--env LDAP_ADMIN_PASSWORD="admin" \
|
2017-11-01 11:19:58 +01:00
|
|
|
--env LDAP_TLS_VERIFY_CLIENT="never" \
|
2024-07-11 09:08:49 +02:00
|
|
|
--env LDAP_TLS_PROTOCOL_MIN=3.0 \
|
|
|
|
--env LDAP_TLS_CIPHER_SUITE="normal" \
|
2017-02-24 11:30:57 +01:00
|
|
|
-p 389:389 \
|
|
|
|
-p 636:636 \
|
2024-07-11 09:08:49 +02:00
|
|
|
--detach --name $NAME osixia/openldap:1.5.0
|
2017-02-24 11:30:57 +01:00
|
|
|
|
2017-11-01 11:19:58 +01:00
|
|
|
sleep 5
|
2017-02-24 11:30:57 +01:00
|
|
|
docker cp ldap_test.ldif ldap_server:/
|
|
|
|
docker exec ldap_server ldapadd -x -D "cn=admin,dc=example,dc=com" -w admin -f /ldap_test.ldif -ZZ
|
|
|
|
|
2017-12-14 10:33:29 +01:00
|
|
|
# failed and retry
|
|
|
|
for number in {1..10}
|
|
|
|
do
|
|
|
|
if [ ! $? -eq 0 ]; then
|
|
|
|
sleep 6
|
|
|
|
echo "retry in $number "
|
|
|
|
docker exec ldap_server ldapadd -x -D "cn=admin,dc=example,dc=com" -w admin -f /ldap_test.ldif -ZZ
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
exit 1
|