docker-compose exec python the input device is not a TTY in AWS EC2 UserData

好久不见. 提交于 2019-12-23 07:47:29

问题


I am using EC2 UserData to bootstrap the instance.

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

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) ?


回答1:


Citing from the docker-compose exec docs:

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.

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

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

export COMPOSE_INTERACTIVE_NO_CLI=1


来源:https://stackoverflow.com/questions/49724232/docker-compose-exec-python-the-input-device-is-not-a-tty-in-aws-ec2-userdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!