How do I get a public ssh key on a docker jenkins image for git authentication?

I just realised you are using git from the question, which I had managed to overlook...

Starting from version 2.0 of "Git Plugin" the credentials for specific repositories can be added in the "Source Code Management" section of the test itself. There should be a label called "Credentials" which allow you to use either a username/password or username/private key combination.

If you create a deploy key for each repository you're interested in running tests add this deploy key as the private key in credentials and you should be good to go.