错误:cannot enable tty mode on non tty input

错误产生:

root@machine1:/data# echo test|docker exec -i 68b cat  test 

root@machine1:/data# echo test|docker exec -it 68b cat 

cannot enable tty mode on non tty input

问题在于,当使用-it时,容器为我们分配了伪终端,等待我们从终端输入数据到伪终端的标准输入。但我们的输入方式却不是从终端,有可能是重定向和管道。官网对于it参数的解释:

But we’ve also passed in two flags: -t and -i.
The -t flag
assigns a pseudo-tty or terminal inside our new container and the -i flag
allows us to make an interactive connection by grabbing the standard in (STDIN)
of the container.


In foreground mode (the default when -d is not specified), docker
run
 can start the process in the container and attach the console to the process’s standard input, output, and standard error. It can even pretend to be a TTY (this is what most command line executables expect) and pass along signals. All of that is
configurable:

-a=[]           : Attach to `STDIN`, `STDOUT` and/or `STDERR`
-t=false : Allocate a pseudo-tty
--sig-proxy=true: Proxify all received signal to the process (non-TTY mode only)
-i=false : Keep STDIN open even if not attached

If you do not specify -a then Docker will attach
all standard streams
. You can specify to which of the three standard streams (STDINSTDOUTSTDERR)
you’d like to connect instead, as in:

$ docker run -a stdin -a stdout -i -t ubuntu /bin/bash

For interactive processes (like a shell), you must use -i -ttogether
in order to allocate a tty for the container process. -i -t is
often written -it as you’ll see in later examples. Specifying -t is
forbidden when the client standard output is redirected or piped, such as in: echo
test | docker run -i busybox cat
.

解决方法:某些情况下it不能同时使用

docker错误的更多相关文章

  1. docker 错误:Error response from daemon: cannot stop container: connect: connection refused": unknown

    docker 错误:Error response from daemon: cannot stop container: 795e4102b2de: Cannot kill container 795 ...

  2. docker 错误排查:无法进入容器.

    docker 错误排查:无法进入容器. #docker exec -it 3c1d bash rpc error: code = 2 desc = oci runtime error: exec fa ...

  3. 如何处理Docker错误消息:please add——insecure-registry

    本地安装Kubernetes时,遇到如下的错误消息: pleade add --insecure-registry gcr.io to daemon's arguments 解决方案:点击Docker ...

  4. Docker 错误:network xxx id xxxx has active endpoints

    问题描述:Docker Compose 部署的项目,使用docker-compose down 命令关闭时,提示错误: Removing network xxxl_default ERROR: net ...

  5. docker 错误

    docker search ubuntuGet http:///var/run/docker.sock/v1.20/images/search?term=ubuntu: dial unix /var/ ...

  6. Docker 错误 docker: invalid reference format. 的解决

    运行 docker run –it –v /dataset:/dataset –v /inference:/inference –v /result:/result floydhub/pytorch: ...

  7. docker 错误failed to open stream: Permission denied 解决方法

    在服务器上面.运行docker时,php目录会发生权限问题解决方法如下: 1:进入php目录下面 docker exec -ti php56 /bin/bash #进入php容器 chown -R w ...

  8. Docker实战(4):Docker错误记一笔

    创建容器的时候报错WARNING: IPv4 forwarding is disabled. Networking will not work. 解决办法: vim /usr/lib/sysctl.d ...

  9. docker错误处理——docker Job for docker.service failed because the control process exited with error code.

    (15条消息) docker Job for docker.service failed because the control process exited with error code._Hel ...

随机推荐

  1. android 工程出现感叹号错误

    android 工程出现感叹号错误: 错误问题分析,曾经导入的jar已经不存在工程目录中,project从其他地方导入时.没有及时更新,比如说svn下载到.project的文件,或者是path的文件. ...

  2. Javascript之类型检测

    一.检测原始(基本数据:字符串.数字.布尔.null.undefined)类型. 用typeof检测原始类型:1.对于字符串,typeof返回"string"; 2.对于数字,ty ...

  3. LintCode "Max Tree"

    Something new I learnt from it: what is Treap and a O(n) construction https://en.wikipedia.org/wiki/ ...

  4. erlang使用leveldb

    用的是诺顿的开源库,参考url来自这里 下载 git clone git@github.com:/norton/lets.git 编译 cd lets ./rebar get-deps ./rebar ...

  5. 微软为Visual Studio开发助手拓展C++支持

    近日,微软宣布了一项 Visual Studio“开发助手”(Developer Assistant)插件的重大更新,其现已支持“基于 C++ 的情境感知 web 解决方案”.开发助手能够嵌入 Vis ...

  6. abstract修饰符

    abstract(C# 参考) abstract 修饰符指示所修饰的内容缺少实现或未完全实现. abstract 修饰符可用于类.方法.属性.索引器和事件. 在类声明中使用 abstract 修饰符以 ...

  7. jQuery Ajax 方法调用 Asp.Net WebService 以及调用aspx.cs中方法的详细例子

    一.jQuery Ajax 方法调用 Asp.Net WebService (引自Terry Feng) Html文件 <!DOCTYPE html PUBLIC "-//W3C//D ...

  8. spark单机模式简单搭建

    待安装列表hadoophivescalaspark一.环境变量配置:~/.bash_profilePATH=$PATH:$HOME/bin export PATH JAVA_HOME=/usr/loc ...

  9. BIP_开发案例04_通过BI Publisher实现打印报表的二维码(案例)(待整理)

    2014-01-01 Created BaoXinjian

  10. suibi 117

    -Djava.net.preferIPv4Stack=true re.findall(r"^(\d+)" , content) content = content.replace( ...