Even when using Docker inside your Jenkins pipeline you can still use the SSH Credentials defined in Jenkins.
Here is a sample Jenkins pipeline that creates a Node v12 Docker container and ssh into an external server.
It is using the SSH Agent Plugin in Jenkins to copy the SSH Private Key into the Docker container .ssh folder.
First you have to create a Private Key and create the Credentials in Jenkins:
Then you can write the pipeline that spins up the Docker container and uses sshagent plugin:
Tested with Jenkins 2.176.2 and SSH Agent Plugin 1.17