docker部署ldap

今日长缨在手,何时缚住苍龙。这篇文章主要讲述docker部署ldap相关的知识,希望能为你提供帮助。
实验环境
cat /etc/redhat-release & & uname -a
CentOS Linux release 7.8.2003 (Core)
Linux centos7-1 3.10.0-1127.el7.x86_64


systemctl stop firewalld & & systemctl disable firewalld
echo SELINUX=disabled > /etc/sysconfig/selinux


cp -pv /etc/sysctl.conf /etc/sysctl.conf.bak
echo net.ipv4.tcp_syncookies = 1 > > /etc/sysctl.conf
echo net.ipv4.tcp_tw_reuse = 1 > > /etc/sysctl.conf
echo net.ipv4.tcp_tw_recycle = 1 > > /etc/sysctl.conf
echo net.ipv4.tcp_fin_timeout = 10 > > /etc/sysctl.conf
echo net.ipv4.ip_forward = 1   > > /etc/sysctl.conf
sysctl -p


软件安装
yum install -y yum-utils device-mapper-persistent-data lvm2
yum install -y docker-ce-18.06.2.ce docker-ce-cli-18.06.2.ce containerd.io  
systemctl daemon-reload
systemctl start docker & & systemctl enable docker
docker --version
Docker version 18.06.2-ce, build 6d37f41


mkdir -pv /usr/local/ldap/data,conf


docker pull osixia/openldap:1.4.0
docker pull osixia/phpldapadmin:0.9.0


docker run -p 389:389 -p 636:636  
--restart=always --user root:root
--env LDAP_TLS_VERIFY_CLIENT="never"  
--env LDAP_ORGANISATTON="openldap"  
--env LDAP_DOMAIN="test.cn"  
--env LDAP_APMIN_PASSWORD="ldap"  
-v /usr/local/ldap/data/:/var/lib/ldap  
-v /usr/local/ldap/conf/:/etc/ldap/slapd.d  
--name ldap osixia/openldap:1.4.0


docker logs -f ldap     查看ldap容器日志
61f77411 slapd starting
docker exec -it ldap /bin/bash   进入ldap容器


docker run -itd   -p 81:80  
--env PHPLDAPADMIN_HTTPS=false  
--env PHPLDAPADMIN_LDAP_HOSTS=192.168.10.30
--name ldapadm   osixia/phpldapadmin:0.9.0


docker logs -f ldapadm             查看ldapadm容器日志
docker exec -it ldapadm /bin/bash   进入ldapadm容器


docker save osixia/openldap:1.4.0 > openldap_images.tar.gz
docker save osixia/phpldapadmin:0.9.0 > openldapadm_images.tar.gz   备份镜像
docker load -i openldap_images.tar.gz                              
docker load -i openldapadm_images.tar.gz                           还原镜像
docker export ldap > ldap_docker.tar.gz                            
docker export ldapadm > ldapadm_docker.tar.gz                       备份容器
docker improt   ldap_docker.tar.gz
docker improt   ldapadm_docker.tar.gz                               还原容器


netstat -tuplna | grep 389
tcp6       0       0 :::389                   :::*                     LISTEN       2689/docker-proxy
netstat -tuplna | grep 636
tcp6       0       0 :::636                   :::*                     LISTEN       2678/docker-proxy
netstat -tuplna | grep 81
tcp6       0       0 :::81                   :::*                     LISTEN       3420/docker-proxy


??http://serverip:81????/??

用户名  cn=admin,dc=test,dc=cn
验证      admin


【docker部署ldap】

    推荐阅读