在Dockerfile中找不到ssh-keys

前端之家收集整理的这篇文章主要介绍了在Dockerfile中找不到ssh-keys前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个简单的Dockerfile,如下所示:

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

运行结果:

docker build -no-cache -t testimage .

是:

Step 5 : RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
 ---> Running in e11ef5962a11
/bin/sh: 1: ssh-keyscan: not found
最佳答案
您需要先安装ssh.

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

然后,各种ssh命令,包括ssh-keyscan,都可用.

这就是我在sshd image Dockerfile中所做的.
我用它到add localhost to my .ssh/known_hosts,以便在sshd服务器上进行本地测试.

截至pjotr-dolphin pjotr-dolphin

If you are only after ssh-keyscan,07004 has smaller footprint than ssh package.

实际上,package openssh-clients for RedHat/CentOS,Oleg Neumyvakin Oleg Neumyvakin

原文链接:https://www.f2er.com/docker/437043.html

猜你在找的Docker相关文章