docker部署ldap
Posted 风雪煮酒
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
用户名 cn=admin,dc=test,dc=cn
验证 admin
以上是关于docker部署ldap的主要内容,如果未能解决你的问题,请参考以下文章
docker下快速部署openldap与PHPLdapAdmin