docker-compose exec python输入的设备不是AWS EC2 UserData中的TTY [英] docker-compose exec python the input device is not a TTY in AWS EC2 UserData

查看:112
本文介绍了docker-compose exec python输入的设备不是AWS EC2 UserData中的TTY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用EC2 UserData引导实例。

I am using EC2 UserData to bootstrap the instance.

引导执行的跟踪日志 / var / log / cloud-init-output。日志,我发现脚本在以下位置停止了:

TRacking log of bootstrap execution /var/log/cloud-init-output.log, I found that the script was stopped at :

+ docker-compose exec web python /var/www/flask/app/db_fixtures.py
the input device is not a TTY

该命令似乎正在交互模式下运行,但是为什么呢?以及如何对此命令强制非交互模式(docker-compose exec)?

It seems like this command it's running in interactive mode, but why ? and how to force noninteractive mode for this command (docker-compose exec) ?

推荐答案

docker-compose exec 文档


默认情况下,命令会分配TTY,因此您可以使用诸如docker-compose exec web sh之类的命令来获取交互式提示。

Commands are by default allocating a TTY, so you can use a command such as docker-compose exec web sh to get an interactive prompt.

要禁用此行为,可以使用 -T 标志禁用伪tty分配:

To disable this behavior, you can either the -T flag to disable pseudo-tty allocation:

docker-compose exec -T web python /var/www/flask/app/db_fixtures.py

或设置 COMPOSE_INTERACTIVE_NO_CLI 环境变量设置为1,然后再运行 docker-compose exec p>

Or set the COMPOSE_INTERACTIVE_NO_CLI environment variable to 1 before running docker-compose exec:

export COMPOSE_INTERACTIVE_NO_CLI=1

这篇关于docker-compose exec python输入的设备不是AWS EC2 UserData中的TTY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆