Heredoc on docker exec

I am basically trying to execute heredoc using the Flask-migrate shell with the Flask application context

Below is the command I'm trying to run inside my bash script

$ docker exec -it mycontainer ./manage shell <<-EOF # shell commands to be executed EOF 

When I try to execute the above command, I get:

cannot enable tty mode on non tty input

This file is managed :

 #!/usr/bin/env python from middleware import create_app, config from middleware.models import db from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand app = create_app(config) migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if __name__ == '__main__': manager.run() 

My question is: is there a way to pass many commands, for example, to heredoc, to the shell?

+5
source share
1 answer

Remove -t from the docker exec to remove the attached pseudo-TTY OR use --tty=false :

 docker exec -i mycontainer ./manage shell <<-EOF # shell commands to be executed EOF 

Or else:

 docker exec -i --tty=false mycontainer ./manage shell <<-EOF # shell commands to be executed EOF 
+4
source

Source: https://habr.com/ru/post/1240268/


All Articles