错误: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. sql查询重复记录并取对应最小值

    原表(aa): id   a                      b 1    22                    456 2    22                    256 ...

  2. Hive(二):windows hive ODBC 安装

    针对Windows 32位和64位的系统对应有多个版本的 Hive ODBC Connector, 在安装的过程中,版本必须完全匹配(即:32位的 connector 只能在32位的系统运行,64位的 ...

  3. ShopEX 4.8.5.81822 前台Getshell

    ShopEX 4.8.5.81822 前台Getshell 作者:unhonker   发布:2014-06-23 00:12   分类:漏洞公布   被撸:8,179次   抢沙发     利用方式 ...

  4. textarea 限制字数

    $("textarea").keyup(function(){        //console.log($(this).val().length);        var L=$ ...

  5. 【Redis】使用Redis Sentinel实现Redis HA

    阅读目录 1 sentinel down-after-milliseconds mymaster 30000 sentinel failover-timeout mymaster 18000 sent ...

  6. C语言每日一题之No.9

    再做决定之前,我还是做好自己该做的.我不希望几年后会悔恨自己为什么在最该努力的时候不愿意吃苦.尊敬的女王陛下,请接题: 一.题目:有已按升序排好顺序的字符串a,编写程序将字符串s中的每个字符按升序的规 ...

  7. [Debug]驱动程序调测方法与技巧

    转自:http://blog.csdn.net/lichangc/article/details/43272457 驱动程序开发的一个重大难点就是不易调试.本文目的就是介绍驱动开发中常用的几种直接和间 ...

  8. SVN Server配置详解 及备份

    SVN简介和工作原理 subversion(简称svn)是近几年崛起的版本管理软件,是cvs的接班人,目前绝大多数开源软件都使用svn作为代码版本管理软件.Subversion支持linux和wind ...

  9. Service代码示例

    package com.homily.training.service; import android.app.Service; import android.content.Intent; impo ...

  10. de.greenrobot.event.EventBusException: Subscriber class dji.midware.a.e already registered to event class

    java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapAppli ...