【发布时间】:2014-10-15 05:23:40
【问题描述】:
我已经安装了 docker (version 0.11.1-dev, build 02d20af/0.11.1);似乎是 CentOS 7 的最新版本(yum update docker 表示没有更新)。
按照installation instructions on jhipster site,我已经拉出当前图像并运行:
sudo docker run -v ~/jhipster:/jhipster -p 8080:8080 -p 9000:9000 -p 4022:22 -t --name jhipster jdubois/jhipster-docker
图像运行正常。但是我无法通过 ssh 连接。如果我使用详细选项运行 ssh:
ssh -vv -p 4022 jhipster@localhost
我明白了:
OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 4022.
debug1: Connection established.
debug1: identity file /home/normunds/.ssh/id_rsa type 1
debug1: identity file /home/normunds/.ssh/id_rsa-cert type -1
debug1: identity file /home/normunds/.ssh/id_dsa type -1
debug1: identity file /home/normunds/.ssh/id_dsa-cert type -1
debug1: identity file /home/normunds/.ssh/id_ecdsa type -1
debug1: identity file /home/normunds/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6p1 Ubuntu-2ubuntu1
debug1: match: OpenSSH_6.6p1 Ubuntu-2ubuntu1 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Connection closed by ::1
如果我尝试访问另一个 Ubuntu 主机,我会收到相同的序列(除了主机、端口和 OpenSSH 版本),但不是最后一行显示“连接已关闭”:
debug1: SSH2_MSG_KEXINIT received
最终连接成功。
我尝试通过 localhost:4022, ip-of-container:22 连接;从本地或远程主机获得相同的结果。
所以问题似乎出在容器或 docker 中(或者最终是 docker 中的 ubuntu 设置)。然而docker top jhipster 显示我 sshd 正在运行 - 是的,跟踪显然表明我到达了 ssh 服务器。
有什么想法吗?
已编辑我运行了 docker 镜像,使其进入命令行,然后在调试模式下运行 sshd:
sudo docker run -v ~/projects:/jhipster -p 8080:8080 -p 9000:9000 -p 4022:22 -t -i --name jhipster jdubois/jhipster-docker /bin/bash
/usr/sbin/sshd -d
为了进一步调试。在连接尝试 sshd 时失败:
chroot("/var/run/sshd"): 不允许操作[preauth]
【问题讨论】:
标签: ubuntu ssh centos docker jhipster