Ho una semplice Dockerfile, esattamente come di seguito:ssh-KeyScan non si trovano in 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
Il risultato della corsa:
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
Ottimo! Non mi è venuto in mente che ssh non fosse già installato. Ma dato che ssh nella docker sembra essere una anti-pratica, suppongo abbia senso. Grazie! – KevinArrrrrg
@KevinArrrrrg sì, per accedere semplicemente a un contenitore in esecuzione dall'host del motore docker, è sufficiente una 'docket exec bash'. Ma per accedere a un contenitore in esecuzione da un'altra macchina, ssh è un ascoltatore legittimo, che però deve essere installato. –
VonC
Se si è solo dopo ssh-keyscan, openssh-client ha un ingombro inferiore rispetto al pacchetto ssh. –