Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 706
Abdennour TOUMI Avatar asked Apr 09 '18 00:04

Abdennour TOUMI


1 Answers

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
like image 188
Yuankun Avatar answered Oct 22 '22 19:10

Yuankun