错误: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. java中的循环

    while循环:     while(循环条件){         循环操作     }     停止while循环有两种方式:1.不再满足while后的循环条件时,循环终止:             ...

  2. 每日学习心得:未定义的命名空间前缀"xsd"问题和<%%>、<%=%>、<%$%>、<%@%>的区别

    2013-6-29 1. 未定义的命名空间前缀“xsd” 上周在项目开发中遇到这样的一个问题,在一个页面用到了自定义的Picker控件,在IE6.7.8.9以及IE10兼容模式下都没有任何问题,但是一 ...

  3. JQueryMobile + PhoneGap 经验总结

    1. pageinit & pageshow JQM的官方手册重点提醒了使用$(document).bind(‘pageinit’)代替$(document).ready(). 但当你需要对某 ...

  4. Python输入和输出

    在很多时候,你会想要让你的程序与用户(可能是你自己)交互.你会从用户那里得到输入,然后打印一些结果.我们可以分别使用raw_input和print语句来完成这些功能.对于输出,你也可以使用多种多样的s ...

  5. VS使用技巧

    1.VS帮助安装 VS2010为例==>注意,长时间未进行帮助安装,不过以下流程应该没有什么问题.如有问题,还请谅解... 2.VS即时窗口的应用 VS2010为例==>即时窗口的用法调试 ...

  6. 水晶报表(web)表格信息展示

    一.环境安装 开发工具使用VS2010+SAP Crystal Reports13_0+.NETformwork4.0 因为vs2010已经不再集成水晶报表,所以需要我们去找合适的版本下载http:/ ...

  7. 328. Odd Even Linked List

    Given a singly linked list, group all odd nodes together followed by the even nodes. Please note her ...

  8. linux网络不同的解决办法

    贯标防火墙,iptables 注释掉/etc/hosts的localhost的ipv6地址映射

  9. HashMap 实现详解

    HashMap是哈希表对Map非线程安全版本的实现,它允许key为null,也允许value为null.所谓哈希表就是通过一个哈希函数计算出一个key的哈希值,然后使用该哈希值定位对应的value所在 ...

  10. Redefining already defined constructor

    报错:Strict standards: Redefining already defined constructor for class SplitWord in D:\wamp\www\wsc\i ...