Thank you for your quick reply, but I do not know any LDAP server URI, search base, or LDAP version. or any admin password for LDAP or AD. but I know my docker host is working for the AD or LDAP login. So I use network host mode, I have all network same with docker host. So now maybe I only need to mount the config files on my docker host to my container? below is my Dockerfile and my docker run command(but it is not working):
$ cat Dockerfile
Use the official Ubuntu 20.04 as a base image
FROM ubuntu:20.04
Disable interactive prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
Install OpenSSH server
RUN apt-get update &&
apt-get install -y net-tools iputils-ping krb5-user openssh-server libnss-ldap libpam-ldap ldap-utils &&
mkdir /var/run/sshd
Permit root login
RUN echo ‘PermitRootLogin yes’ >> /etc/ssh/sshd_config
Change SSH port to 53222
RUN sed -i ‘s/#Port 22/Port 53222/’ /etc/ssh/sshd_config
Set root password (change ‘123456’ to a secure password)
RUN echo ‘root:123456’ | chpasswd
Expose the new SSH port
EXPOSE 53222
Start the SSH service
CMD [“/usr/sbin/sshd”, “-D”]
$ docker run --name my-ubuntu-sshd --network host -v /etc/krb5.conf:/etc/krb5.conf:ro -v /etc/nsswitch.conf:/etc/nsswitch.conf:ro -v /etc/pam.d:/etc/pam.d:ro -d my-ubuntu-sshd
b227750f4efa7e279fdfa266abd4ec109e5fb90709c66b51d9117f44f23f9dbd