加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Dockerfile中找不到ssh-keys

发布时间:2020-12-16 03:53:55 所属栏目:安全 来源:网络整理
导读:我有一个简单的Dockerfile,如下所示: FROM ubuntu:14.04RUN apt-get updateRUN apt-get -y upgradeRUN mkdir -p /root/.sshRUN touch /root/.ssh/known_hostsRUN ssh-keyscan github.com /root/.ssh/known_hosts 运行结果: docker build -no-cache -t test

我有一个简单的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读