docker执行官Heredoc
我基本上试图通过Flask-migrate的Flask应用上下文来执行heredoc
下面是我试图在我的bash脚本中运行的命令
$ docker exec -it mycontainer ./manage shell <<-EOF # shell commands to be executed EOF
当试图执行上面的命令时,我得到:
cannot enable tty mode on non tty input
这是pipe理文件:
#!/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()
我的问题是有办法像在heredoc中传递一组命令到shell吗?
从docker exec
命令中删除-t
选项以删除附加的pseudo-TTY
或使用--tty=false
:
docker exec -i mycontainer ./manage shell <<-EOF # shell commands to be executed EOF
要不然:
docker exec -i --tty=false mycontainer ./manage shell <<-EOF # shell commands to be executed EOF