错误: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. ORA-12545:因目标主机或对象不存在,连接失败!

    错误原因是配置错误主机名 解决: 1. 搜索你自己安装的Oracle路径,找到这俩个文件 tnsnames.ora 和 listener.ora,修改这两个文件,修改HOST=自己的主机名 我的路径如 ...

  2. 如何将NetBeans转换为英文版(图)

    很郁闷,又是一个系统语言的问题. NetBeans下载下来之后,怎么装都是个中文版,或者半中文半英文,不伦不类的.上网找了一个圈,很多都讲得不清楚,最后终于有了一个答案: 在NetBeans的配置文件 ...

  3. SQLite介绍、学习笔记、性能测试

    SQLite介绍.学习笔记.性能测试 哪些人,哪些公司或软件在用SQLite: Nokia's Symbian,Mozilla,Abobe,Google,阿里旺旺,飞信,Chrome,FireFox可 ...

  4. 一个快速、完善的Android开发框架整合实践(QuickAndroid)

    https://github.com/alafighting/QuickAndroid QuickAndroid 一个快速.完善的Android开发框架整合实践 QA项目简介 本框架QuickAndr ...

  5. VS 开发工具中的Remote Debug 功能远程调试程序经验分享

    前言: 有时候我们Dev(开发人员)需要debug tester(测试人员)或者customer(客户)的环境,可tester的机器上没有Code,是不是有点着急? 而且是多版本应用且tester 发 ...

  6. apache/php 开启 gzip压缩

    1.php方式开启 原理: header("Content-Encoding: gzip"); echo gzencode('songjiankang'); 示例1: functi ...

  7. RabbitMQ介绍3 - 运行和管理RabbitMQ

    安装.官方介绍:http://www.rabbitmq.com/download.html.一般产品环境会部署到Linux环境,但做为简单尝试,可以部署到Windows上(这里是部署介绍:http:/ ...

  8. Visual Stadio 2015创建WebApplication应用和运行赏析

    专题图: 1,创建一个WebApplication应用 2,项目结构和布局  3,运行项目 作者:ylbtech出处:http://ylbtech.cnblogs.com/本文版权归作者和博客园共有, ...

  9. JAVA关系运算符

    常用的关系运算符: 编号 关系运算符 说明 1 > 大于 2 < 小于 3 == 等于 4 != 不等于 5 >= 大于或等于 6 <= 小于或等于 用关系运算符判断后返回的值 ...

  10. async callback z

    public class StackOverflow_5979252 { [ServiceContract(Name = "IMessageCallback")] public i ...