FuzzyAmi
FuzzyAmi

Reputation: 8147

Installing ssh-keyscan on Alpine linux?

In order to successfully clone a private repository into an Alpine-based docker, I needed to run the following command: ssh-keyscan github.com >> ~/.ssh/known_hosts.

But since ssh-keyscan isn't part of Alpine linux (by default), I have to install it first with apk. The problem is: I dont know how - and I can't find it anywhere on Google.

Upvotes: 32

Views: 25622

Answers (3)

Pierre Ozoux
Pierre Ozoux

Reputation: 830

This would do the job:

RUN apk add --no-cache openssh-client \
 && ssh-keyscan github.com > ~/.ssh/known_hosts

You can find the content of an Alpine linux package on this website: https://pkgs.alpinelinux.org/contents?branch=edge&name=openssh-client&arch=x86&repo=main

Upvotes: 27

FuzzyAmi
FuzzyAmi

Reputation: 8147

This took way too long to find out as its not documented anywhere:

apk update && apk add openssh

or alternatively:

apk add -qU openssh

Upvotes: 43

Jakub Jirutka
Jakub Jirutka

Reputation: 10827

The command you're looking for is actually ssh-keyscan and you can easily find it using pkgs.alpinelinux.org/contents.

Upvotes: 7

Related Questions