23. February 2017

Automate your ssh or git clone from inside Docker

Solution to automating any ssh command is to avoid having to type yes to all the various questions exposed. For this post I will limit myself to the fact that you have the keys inside your Docker. If you burnt your precious ssh keys into image which is bad (ADD command), or added via volume mapping when running a docker (-v flag) does not matter as long as you know where they are.
Once you are in docker you are logged in as root (by default in most cases). To avoid this you can be logged in as any other user, but then just replace root with ~ in below examples.
Common errors which you will face are: