远程主机关闭到我的容器的SSH连接

远程主机关闭到我的容器的SSH连接,ssh,docker,containers,ibm-cloud,public-key,Ssh,Docker,Containers,Ibm Cloud,Public Key,我尝试连接到bluemix运行容器,但出现以下错误: ssh -p 22 login@134.*.*.* Connection to 134.*.*.* closed by remote host. Connection to 134.*.*.* closed. 为了安全,我隐藏了ip 在docker容器构建期间,我将我的ssh公钥添加到/home/login/.ssh/authorized_key。然后启动容器(运行sshd)并打开22端口 在本地(服务器上有docker),我可以使用容器的

我尝试连接到bluemix运行容器,但出现以下错误:

ssh -p 22 login@134.*.*.*
Connection to 134.*.*.* closed by remote host.
Connection to 134.*.*.* closed.
为了安全,我隐藏了ip

在docker容器构建期间,我将我的ssh公钥添加到/home/login/.ssh/authorized_key。然后启动容器(运行sshd)并打开22端口

在本地(服务器上有docker),我可以使用容器的私钥连接到ssh。但当我在Bluemix上启动container时,即使在属性public-ip-address和发布22个tcp端口之后,我也无法连接到ssh

为了运行我推送到IBMRepo的容器,我使用ICE cli来运行带有入口点脚本的容器,该脚本启动所有服务(在sshd中)

然后,我转到bluexmix web dashboard以指定公共ip地址的属性

当我收到对sshd服务器的响应时,容器似乎可以工作并且可以访问,但我不明白为什么我可以在docker服务器上连接,而不能在bluemix服务器上连接

我为您提供ssh详细连接:

OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 134.168.6.95 [134.168.6.95] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/idcware/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/idcware/.ssh/id_rsa type 1
debug1: identity file /home/idcware/.ssh/id_rsa-cert type -1
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/idcware/.ssh/id_dsa" as a RSA1 public key
debug1: identity file /home/idcware/.ssh/id_dsa type -1
debug1: identity file /home/idcware/.ssh/id_dsa-cert type -1
debug1: identity file /home/idcware/.ssh/id_ecdsa type -1
debug1: identity file /home/idcware/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/idcware/.ssh/id_ed25519 type -1
debug1: identity file /home/idcware/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "134.168.6.95" from file "/home/idcware/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/idcware/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: curve25519-sha256@libssh.org need=16 dh_need=16
debug1: kex: curve25519-sha256@libssh.org need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA f8:88:10:d1:91:bd:42:ec:d1:04:e5:00:c6:ab:11:e9
debug3: load_hostkeys: loading entries for host "134.168.6.95" from file "/home/idcware/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/idcware/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys
debug1: Host '134.168.6.95' is known and matches the ECDSA host key.
debug1: Found key in /home/idcware/.ssh/known_hosts:3
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/idcware/.ssh/id_rsa (0x7fb6e3792fd0),
debug2: key: /home/idcware/.ssh/id_dsa ((nil)),
debug2: key: /home/idcware/.ssh/id_ecdsa ((nil)),
debug2: key: /home/idcware/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup gssapi-keyex
debug3: remaining preferred: gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-keyex
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug2: we did not send a packet, disable method
debug3: authmethod_lookup gssapi-with-mic
debug3: remaining preferred: publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure.  Minor code may provide more information
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available
debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/idcware/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/idcware/.ssh/id_dsa
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey: RSA 33:a3:84:5c:55:b4:4e:2d:c9:83:19:51:37:c6:5e:27
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to 134.168.6.95 ([134.168.6.95]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)
Connection to 134.168.6.95 closed by remote host.
Connection to 134.168.6.95 closed.
Transferred: sent 3756, received 2112 bytes, in 0.0 seconds
Bytes per second: sent 278448.9, received 156571.9
debug1: Exit status -1
对于容器日志,我在bluemix web dashboard的寄售中只有以下内容:

Dec 4 14:16:31 instance-0007a14f syslog-ng[11]: Log statistics; processed='src.internal(s_sys#1)=12', stamp='src.internal(s_sys#1)=1449234391', processed='destination(d_mlal)=0', processed='center(received)=12', processed='destination(d_spol)=0', processed='destination(d_mesg)=24', processed='destination(d_mail)=0', processed='destination(d_auth)=61', processed='destination(d_cron)=0', processed='destination(d_bv_info)=0', processed='center(queued)=85', processed='source(s_bv_syslog)=0', processed='src.none()=0', stamp='src.none()=0', processed='destination(d_bv_crit)=0', processed='global(payload_reallocs)=20', processed='global(sdata_updates)=0', processed='destination(d_bv_all)=0', processed='destination(d_bv_err)=0', processed='destination(d_boot)=0', processed='destination(d_kern)=0', processed='global(msg_clones)=0', processed='source(s_sys)=12', processed='destination(d_bv_process)=0'

由于容器可以工作并且可以访问,但您不能仅在Bluemix上访问它,因此我建议您使用支持/帮助小部件直接从Bluemix控制台打开支持请求,或发送电子邮件至support@bluemix.net:通过这种方式,您将让IBM容器支持团队参与检查和修复此问题。他们将能够对您的错误进行深入调查

请提供组织和空间GUID以及您使用的图像的一些详细信息

您可以使用CF CLI检索组织和空间GUID(当您已登录时):

cf组织--guid
cf空间--guid

使用容器的一个原则是,容器不应启动多个进程,在您的情况下是ssh,也不应启动容器正在运行的任何进程。 还有另一种方法可以使用
exec

Science Docker 1.3您可以通过以下方式访问正在运行的容器:

docker exec命令

在bluemix的实践中:

cf ic exec-it容器/bin/bash

这将使用绝对路径(/bin/bash part)启动二进制bash,并以交互方式附加tty+保持连接打开(-it part)


更多信息:

1)详细的连接日志可能会有所帮助。2) 容器中的错误日志应该会有帮助。感谢您的回答,我提供了ssh详细信息,但我不理解您所说的“容器中的错误日志”是什么意思。我没有来自容器的日志。我只有ICE cli来管理集装箱这看起来像是自动启用后的故障
sshd
在普通Linux上将其错误记录到
/var/log/secure
/var/log/auth.log
。这看起来用户没有shell,有一些错误的权限或类似的东西,但是看起来很奇怪,因为完全相同的容器在没有bluemix服务器的情况下工作正常,而我的用户是一个具有标准权限和shell的标准linux用户。如果没有ssh,我无法在日志“secure”或“auth.log”中查看错误…我将尝试此操作,并在了解更多信息后在此处发布结果。谢谢你的回答
Dec 4 14:16:31 instance-0007a14f syslog-ng[11]: Log statistics; processed='src.internal(s_sys#1)=12', stamp='src.internal(s_sys#1)=1449234391', processed='destination(d_mlal)=0', processed='center(received)=12', processed='destination(d_spol)=0', processed='destination(d_mesg)=24', processed='destination(d_mail)=0', processed='destination(d_auth)=61', processed='destination(d_cron)=0', processed='destination(d_bv_info)=0', processed='center(queued)=85', processed='source(s_bv_syslog)=0', processed='src.none()=0', stamp='src.none()=0', processed='destination(d_bv_crit)=0', processed='global(payload_reallocs)=20', processed='global(sdata_updates)=0', processed='destination(d_bv_all)=0', processed='destination(d_bv_err)=0', processed='destination(d_boot)=0', processed='destination(d_kern)=0', processed='global(msg_clones)=0', processed='source(s_sys)=12', processed='destination(d_bv_process)=0'
cf org <orgname> --guid
cf space <spacename> --guid