Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
terminal api
Browse files Browse the repository at this point in the history
  • Loading branch information
francescou committed Jun 30, 2016
1 parent 012841e commit 258b7e0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,21 @@ def stop():
get_project_with_name(name).stop()
return jsonify(command='stop')

@app.route(API_V1 + "terminal", methods=['POST'])
def terminal():
"""
docker-compose exec
"""
json = loads(request.data)
name = json["name"]
container_id = json["id"]
cmd_str = json["command"]

project = get_project_with_name(name)
exec_instance = project.client.exec_create(container_id, cmd=cmd_str)
data = project.client.exec_start(exec_instance["Id"], tty=True)
return jsonify(data=data)

@app.route(API_V1 + "down", methods=['POST'])
@requires_auth
def down():
Expand Down

0 comments on commit 258b7e0

Please sign in to comment.