title: Docker, how to deal with ssh keys, known_hosts and authorized_keys
body: <p>In docker, how to scope with the requirement of configuring known_hosts, authorized_keys and ssh connectivity in general, when container have to talk with external systems?</p>
  
  <p>For example, I'm running jenkins container and try to checkout the project from github in job, but connection fails with the error <code>host key verification failed</code></p>
  
  <p>This could be solved by login into container, connect to github manually and trust the host key when prompted. However this isn't  proper solution, as everything needs to be 100% automated (I'm building CI pipeline with ansible and docker). Another (clunky) solution would be to provision the running container with ansible, but this would make things messy and hard to maintain. Jenkins container doesn't even has ssh daemon, and I'm not sure how to ssh into container from other host. Third option would be to use my own Dockerfile extending jenkins image, where ssh is configured, but that would be hardcoding and locking the container to this specific environment.</p>
  
  <p>So what is the correct way with docker to manage (and automate) connectivity with external systems?</p>