diff --git a/data/Dockerfiles/dockerapi/server.py b/data/Dockerfiles/dockerapi/server.py index b911b06b..78fc5247 100644 --- a/data/Dockerfiles/dockerapi/server.py +++ b/data/Dockerfiles/dockerapi/server.py @@ -67,6 +67,20 @@ class container_post(Resource): except Exception as e: return jsonify(type='danger', msg=str(e)) + elif post_action == 'top': + try: + for container in docker_client.containers.list(all=True, filters={"id": container_id}): + return jsonify(type='success', msg=container.top()) + except Exception as e: + return jsonify(type='danger', msg=str(e)) + + elif post_action == 'stats': + try: + for container in docker_client.containers.list(all=True, filters={"id": container_id}): + return jsonify(type='success', msg=container.stats(decode=True, stream=False)) + except Exception as e: + return jsonify(type='danger', msg=str(e)) + elif post_action == 'exec': if not request.json or not 'cmd' in request.json: