一千萬個為什麽

搜索

SSH到Docker容器中的VM



我有一個基於Ubuntu Xenial的Docker鏡像。在該容器中,我嘗試使用Vagrant和VirtualBox啟動FreeBSD VM(註意:Docker的主機操作系統是基於Vagrant和VirtualBox的VM)。 VM正在配置好,但是,Vagrant不能在那裏ssh。我也嘗試過在容器內調試ssh:

# ssh -vvv -p 2222 [email protected]
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "127.0.0.1" port 2222
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
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_7.2p2 Ubuntu-4ubuntu2.2
ssh_exchange_identification: read: Connection reset by peer

主機操作系統也一樣:

# ssh -p 1111 [email protected]
ssh_exchange_identification: read: Connection reset by peer

我用下面的參數運行容器:

docker run --privileged -v /dev:/dev -p 1111:2222 vm:latest

我試圖運行輕量級圖像,如此處所述,並且所有內容都已成功啟動。

有關它的任何建議/想法?

轉載註明原文: SSH到Docker容器中的VM

一共有 1 個回答:

它看起來像ssh timeout的問題與嵌套的可視化限制有關。因此,盡管在容器中的BIOS虛擬機中啟用可視化仍然不會被配置。我在此處找到類似的答案。

一旦我在主機操作系統上啟動Docker容器,問題就消失了,虛擬機已成功配置。