Ssh-keyscan not found in Dockerfile

I have a simple Docker file as shown below:

FROM ubuntu:14.04 RUN apt-get update RUN apt-get -y upgrade RUN mkdir -p /root/.ssh RUN touch /root/.ssh/known_hosts RUN ssh-keyscan github.com >> /root/.ssh/known_hosts 

The result of work:

 docker build -no-cache -t testimage . 

is an:

 Step 5 : RUN ssh-keyscan github.com >> /root/.ssh/known_hosts ---> Running in e11ef5962a11 /bin/sh: 1: ssh-keyscan: not found 
+6
source share
1 answer

First you need to install ssh.

 RUN apt-get -yq update && \ apt-get -yqq install ssh 

Then various ssh commands will be available, including ssh-keyscan .

This is what I did in my sshd Dockerfile .
I used it to add localhost to my .ssh/known_hosts to do some test locally on the sshd server.

As pjotr-dolphin commented below :

If you are only after ssh-keyscan , openssh-client is smaller than the ssh package.

+14
source

All Articles