Reputation:
I am trying to write a Dockerfile to access a remote mySQL database using ssh tunneling.
Tried with the following Run
command:
ssh -f -N username@hostname -L [local port]:[database host]:[remote port] StrictHostKeyChecking=no
and getting this error:
"Host key verification failed" ERROR
Upvotes: 2
Views: 563
Reputation: 3851
Assuming that the Docker container does not have access to any SSH data (i.e.: there is no ~/.ssh/known_hosts
), you have two ways to handle this:
ssh-keyscan -t rsa server.example.com > ~/.ssh/my_known_hosts
from within the container to add the remote hostmy_known_hosts
or simply COPY
a the whole file to the container.Either of these approaches should do it.
Upvotes: 1