【发布时间】:2018-04-12 01:16:14
【问题描述】:
我想直接从 ssh 命令以交互方式运行 docker 容器。
我当前的代码如下所示(我使用echo hi 作为占位符):
$ ssh vagrant@127.0.0.1 -p 2222 "docker run -ti ubuntu:xenial echo hi"
the input device is not a TTY
我也尝试过明确地制作交互式登录 shell:
$ ssh vagrant@127.0.0.1 -p 2222 "bash -ilc 'docker run -ti ubuntu:xenial'"
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
the input device is not a TTY
如果我使用 ssh 并以交互方式运行该命令,效果会很好:
$ ssh vagrant@127.0.0.1 -p 2222
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-34-generic x86_64)
* Documentation: https://help.ubuntu.com/
----------------------------------------------------------------
Ubuntu 14.04.5 LTS built 2016-08-26
----------------------------------------------------------------
Last login: Mon Oct 30 23:25:35 2017 from 10.0.2.2
vagrant@vagrant:~$ docker run -ti ubuntu:xenial echo hi
hi
我在这里错过了什么?
【问题讨论】: