Problem with openssh docker image

Hi folks

I set up an openssh docker container but cannot connect with ssh. I’m sure it’s some stupid mistake but I don’t find it. In docker I set the env PUBLIC_KEY_DIR where I point to the directory with my public key. In the docker log I can see that the key was read: Public key from file ‘/config/mykeys/test.pub’ added

When I try to connect using: “ssh -i test -p 2222 10.3.x.x” or “ssh -i test -p 2222 root@10.3.x.x” I get the following error message: ssh: connect to host 10.3.x.x port 2222: Connection refused

The keypair I generated with the embedded keygen.sh script. Any idea what I’m doing wrong? Thank you for your help.

User shouldn’t be root

Thanks for your feedback. This was the problem. I added an additional env USER_NAME and used this to login with success. Thank you!