关于docker使用run命令加上参数-it时出现the input device is not a TTY. If you are using mintty, try prefixing the

最近在用docker时创建redis的镜像时,使用命令
docker run -it --name redis-master redis /bin/bash
出现问题
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
就算加上winpty在前缀,也出现问题
/usr/local/bin/docker-entrypoint.sh: 16: exec: C:/Program Files (x86)/Git/usr/bin/bash.exe: not found

最后采用了命令才解决问题

winpty docker run -it --name redis-master redis bash

如果采用这种方法的话要退出容器但是不结束容器可以采用按住ctrl+p+q,如果想要退出同时结束容器可以采用输入命令exit

同时,如果采用第一种方式的,要想再次进入容器可以使用命令winpty  docker attach 容器名/容器Id

还有问题就是使用-v挂载文件+winpty控制输入流的的时候出现的问题

Error response from daemon: invalid mode: \Program Files (x86)\Git\usr\src\app.
invalid volume specification: '/c/Users/Administrator/project/Django/App1:~/usr/src/app': invalid mount config for type "bind": invalid mount path: '~/usr/src/app' mount path must be absolute.

我才用一下方法解决,抛弃了winpty

docker run -it -d --name App1 --link redis-master:db  -v /project/Django/App1:/usr/src/app django /bin/bash

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值