2014-07-22 24 views
7

के निर्माण के दौरान निजी कुंजी का उपयोग करके एसएसएच नहीं कर सकता है मुझे डॉकर छवि निर्माण के दौरान गिटहब पर होस्ट की गई एक निजी गिट भंडार की जांच करने में समस्या हो रही है। वर्बोज़ मोड में SSH से त्रुटि है:डॉकर छवि

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to github.com [192.30.252.130] port 22. 
debug1: Connection established. 
debug1: permanently_set_uid: 0/0 
debug1: identity file /root/.ssh/id_rsa type -1 
debug1: identity file /root/.ssh/id_rsa-cert type -1 
debug1: identity file /root/.ssh/id_dsa type -1 
debug1: identity file /root/.ssh/id_dsa-cert type -1 
debug1: identity file /root/.ssh/id_ecdsa type -1 
debug1: identity file /root/.ssh/id_ecdsa-cert type -1 
debug1: identity file /root/.ssh/id_ed25519 type -1 
debug1: identity file /root/.ssh/id_ed25519-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0 
debug1: no match: libssh-0.6.0 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-sha1 none 
debug1: kex: client->server aes128-ctr hmac-sha1 none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 
debug1: read_passphrase: can't open /dev/tty: No such device or address 
Host key verification failed. 

/dev/tty डिवाइस उपस्थित होना प्रतीत होता है:

FROM ubuntu:trusty 

ADD . /my_app 
ADD ./config/ssh/docker_ssh_key /root/.ssh/id_rsa 

RUN ls -al /dev 
RUN ssh -t -t -v [email protected] 

CMD bundle exec thin -p $PORT -R config.ru start 
:

total 4 
drwxr-xr-x 4 root root  340 Jul 22 17:12 . 
drwxr-xr-x 130 root root 4096 Jul 22 17:12 .. 
lrwxrwxrwx 1 root root  13 Jul 22 17:12 fd -> /proc/self/fd 
crw-rw-rw- 1 root root 1, 7 Jul 22 17:12 full 
c--------- 1 root root 10, 229 Jul 22 17:12 fuse 
lrwxrwxrwx 1 root root  11 Jul 22 17:12 kcore -> /proc/kcore 
crw-rw-rw- 1 root root 1, 3 Jul 22 17:12 null 
lrwxrwxrwx 1 root root  8 Jul 22 17:12 ptmx -> pts/ptmx 
drwxr-xr-x 2 root root  0 Jul 22 17:12 pts 
crw-rw-rw- 1 root root 1, 8 Jul 22 17:12 random 
drwxrwxrwt 2 root root  40 Jul 22 17:12 shm 
lrwxrwxrwx 1 root root  15 Jul 22 17:12 stderr -> /proc/self/fd/2 
lrwxrwxrwx 1 root root  15 Jul 22 17:12 stdin -> /proc/self/fd/0 
lrwxrwxrwx 1 root root  15 Jul 22 17:12 stdout -> /proc/self/fd/1 
crw-rw-rw- 1 root root 5, 0 Jul 22 17:12 tty 
crw-rw-rw- 1 root root 1, 9 Jul 22 17:12 urandom 
crw-rw-rw- 1 root root 1, 5 Jul 22 17:12 zero 

यहाँ अपने परीक्षण को दर्शाता हुआ मेरी Dockerfile के नीचे छीन संस्करण है

मैंने निर्माण का परीक्षण किया है और पता है कि कुंजी काम करती है। अगर मैं रन कमांड के बिना छवि बनाता हूं और इंटरैक्टिव शैल के साथ एक कंटेनर शुरू करता हूं तो मैं गिट रिपॉजिटरी को ठीक से एक्सेस कर सकता हूं।

मुझे इसी तरह के त्रुटियों के संदेशों के साथ कुछ अन्य प्रश्न मिल गए हैं। लेकिन वे /dev/tty गुम होने के लिए हैं जो यहां मामला प्रतीत नहीं होता है। कोई विचार?

+0

क्या निजी कुंजी (क्लाइंट या सर्वर पर) पासफ्रेज़ है? यदि ऐसा है, तो यह देखने के लिए एक परीक्षण का प्रयास करें कि एक अनएन्क्रिप्टेड निजी कुंजी का उपयोग करना एक ही समस्या का कारण बनता है। यह सबसे सुरक्षित सेटअप नहीं है, लेकिन यह आपको इस मुद्दे को अलग करने में मदद कर सकता है। – phylae

उत्तर

7

आपको गिथब होस्ट कुंजी स्वीकार करने की आवश्यकता है। ssh-keyscan का उपयोग करें:

+3

धन्यवाद! आखिरकार मुझे लगा कि मेजबान कुंजी को स्वीकार करने के लिए यह संकेत आया था। इसे स्वीकार करने से मैन्युअल रूप से इस प्रॉम्प्ट को दबा दिया जाता है और एसएसएच जारी रहता है। –

+0

धन्यवाद। प्रतिलिपि ~/.ssh/know_hosts के बिना एक कंटेनर डॉकर में गिट क्लोन का एहसास करने के लिए आवश्यक है। –

+0

आप कुंजी जांच भी अक्षम कर सकते हैं: http://askubuntu.com/questions/123072/ssh-automatically-accept-keys – Ben

संबंधित मुद्दे