DOCKER container ssh no password authentication

I have containers trying to make one as ansible server and other one as client.i did copied public key to the other container.

while doing password is asked to connect to the other container.but I did password authentication to false in etc/ssh/sshd_config file and restarted the ssh service now permission is denied is coming.

I need to ssh to other container without password as I copied public key to the other container.

Purpose of doing this is to make ansible server and client so that to run a playbook to client it should not ask for password.

Can someone help me out

Thanks in advance.

The problem could be an SSHD misconfiguration, disabled PubkeyAuthentication or wrong authorized_keys file, missing or wrong SSH key on client side or something else.

If you can’t find the problem, please, share some command, what you run, and configuration file without sensitive data.