-
Notifications
You must be signed in to change notification settings - Fork 1
Docker Flask API
Method: GET
List all containers and get their statistics.
Sample Output
{ "19719ffb90": { "cpu_percent": 0, "image_short_id": "sha256:bc26f1ed35", "image_tags": [ "nginx:latest" ], "mem_limit": 3945.04296875, "mem_max_usage": 4.53515625, "mem_usage": 1.95703125, "name": "stupefied_einstein", "short_id": "19719ffb90", "status": "running" }, "c08222ab92": { "cpu_percent": 0, "image_short_id": "sha256:bc26f1ed35", "image_tags": [ "nginx:latest" ], "mem_limit": 3945.04296875, "mem_max_usage": 4.640625, "mem_usage": 2.05859375, "name": "lucid_kirch", "short_id": "c08222ab92", "status": "running" } }
Method: POST
Create a container.
Content-Type: application/json
Sample JSON
{ "image_name":"nginx", "mem_limit":"2g", "cpu_percent_limit":50, "ports":{"80/tcp":8080}, "environment":["MYSQL_NAME=mysql","SERVER_NAME=mynginx"], "device_read_bps":[{"Path": "/dev/sda", "Rate": 10485760}], "device_read_iops":[{"Path": "/dev/sda", "Rate": 1000}], "device_write_bps":[{"Path": "/dev/sda", "Rate": 10485760}], "device_write_iops":[{"Path": "/dev/sda", "Rate": 1000}] }
image_name (String)[Required]: The image to run.
ports: (dict)[Not Required]: Ports to bind inside the container.
mem_limit: (int or str)[Not Required]: The maximum physical memory the container can use. Accepts a value (which represent the memory limit of the created container in bytes) or a string with a units identification char (100000b, 1000k, 128m, 1g). If a string is specified without a units character, bytes are assumed as an intended unit. None for no limit, namely the container can use all physical memory of the host machine. (Null mem_limit may cause conflicts with issue #10 "Handling no more memory available", therefore we should specify mem_limit for each container. )
cpu_percent_limit: (int)[Not Required]: The maximum proportion of cpu time a container can use, in percentage.
environment: (list)[Not Required]: Environment variables to set inside the container in the format ["SOMEVARIABLE=xxx"].
device_read_bps: (list)[Not Required]: Limit read rate (bytes per second) from a device in the form of: [{“Path”: “device_path”, “Rate”: rate}] Please make sure the correct path is used.
device_read_iops: (list)[Not Required]: Limit read rate (IO per second) from a device. Please make sure the correct path is used.
device_write_bps: (list)[Not Required]: Limit write rate (bytes per second) from a device. Please make sure the correct path is used.
device_write_iops: (list)[Not Required]: Limit write rate (IO per second) from a device. Please make sure the correct path is used.
Method: GET
List all images and get their information.
Sample Output
{ "sha256:bc26f1ed35": { "created": "2018-09-25T17:21:29.327116583Z", "size": 109083698, "tags": [ "nginx:latest" ] }, "sha256:dabb527449": { "created": "2018-09-26T00:28:57.434750623Z", "size": 177573536, "tags": [ "httpd:latest" ] } }
Method: POST
Pull images
Content-Type: application/json
Sample JSON
{ "image_name":["nginx","httpd","hello-world:latest"] }
Default tag is latest
Method: GET
Update all images.
Method: GET
Get information of an image.
Method: DELETE
Delete an image.