def shell(app, container, host, command):
"""
Runs a single container with foreground enabled and overridden to use bash.
"""
# Get the current formation
formation = FormationIntrospector(host, app.containers).introspect()
# Make a Formation with that container launched with bash in foreground
try:
instance = formation.add_container(container, host)
except ImageNotFoundException as e:
click.echo(RED(str(e)))
sys.exit(1)
instance.foreground = True
if command:
instance.command = ['/bin/bash -lc "{}"'.format(' '.join(command))]
else:
instance.command = ["/bin/bash -l"]
# Run that change
task = Task("Shelling into {}".format(container.name), parent=app.root_task)
run_formation(app, host, formation, task)
评论列表
文章目录