【发布时间】:2016-08-03 04:09:31
【问题描述】:
我需要登录到 docker 容器中的 bash 控制台,该容器在远程主机中运行。
以下命令起作用:
(local)$ ssh -i myKey user@remoteHost
(remote)$ docker exec -it myContainer /bin/bash
请注意,我在 SSH 中使用无密码身份验证。我的场景涉及更多,包括进入单个命令的脚本(实际上也可以计算出 docker 容器 ID),这足以说明问题。当我尝试在单个命令中运行时,出现以下错误:
(local)$ ssh -i myKey user@remoteHost "docker exec -it myContainer /bin/bash"
cannot enable tty mode on non tty input
如何运行此 SSH 并克服“无法启用 tty”错误?
【问题讨论】: