Browse code

Document new /system/df and /{containers,volumes,images}/prune API EndPoints

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

Kenfe-Mickael Laventure authored on 2016/08/31 08:59:24
Showing 1 changed files
... ...
@@ -1564,6 +1564,38 @@ Upload a tar archive to be extracted to a path in the filesystem of container
1564 1564
     - no such file or directory (**path** resource does not exist)
1565 1565
 - **500** – server error
1566 1566
 
1567
+
1568
+### Prune unused containers
1569
+
1570
+`POST /containers/prune`
1571
+
1572
+Delete unused containers
1573
+
1574
+**Example request**:
1575
+
1576
+    POST /containers/prune HTTP/1.1
1577
+    Content-Type: application/json
1578
+
1579
+    {
1580
+    }
1581
+
1582
+**Example response**:
1583
+
1584
+    HTTP/1.1 200 OK
1585
+    Content-Type: application/json
1586
+
1587
+	{
1588
+	    "ContainersDeleted": [
1589
+	        "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148"
1590
+	    ],
1591
+	    "SpaceReclaimed": 109
1592
+	}
1593
+
1594
+**Status codes**:
1595
+
1596
+-   **200** – no error
1597
+-   **500** – server error
1598
+
1567 1599
 ## 3.2 Images
1568 1600
 
1569 1601
 ### List Images
... ...
@@ -2191,6 +2223,54 @@ Search for an image on [Docker Hub](https://hub.docker.com).
2191 2191
 -   **200** – no error
2192 2192
 -   **500** – server error
2193 2193
 
2194
+### Prune unused images
2195
+
2196
+`POST /images/prune`
2197
+
2198
+Delete unused images
2199
+
2200
+**Example request**:
2201
+
2202
+    POST /images/prune HTTP/1.1
2203
+    Content-Type: application/json
2204
+
2205
+    {
2206
+        "DanglingOnly": false,
2207
+    }
2208
+
2209
+**Example response**:
2210
+
2211
+    HTTP/1.1 200 OK
2212
+    Content-Type: application/json
2213
+
2214
+	{
2215
+	    "ImagesDeleted": [
2216
+	        {
2217
+	            "Untagged": "busybox:latest"
2218
+	        },
2219
+	        {
2220
+	            "Untagged": "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2221
+	        },
2222
+	        {
2223
+	            "Deleted": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749"
2224
+	        },
2225
+	        {
2226
+	            "Deleted": "sha256:8ac8bfaff55af948c796026ee867448c5b5b5d9dd3549f4006d9759b25d4a893"
2227
+	        }
2228
+	    ],
2229
+	    "SpaceReclaimed": 1092588
2230
+	}
2231
+
2232
+**JSON parameters**:
2233
+
2234
+- **DanglingOnly**: if true only delete unused AND untagged images
2235
+
2236
+**Status codes**:
2237
+
2238
+-   **200** – no error
2239
+-   **500** – server error
2240
+
2241
+
2194 2242
 ## 3.3 Misc
2195 2243
 
2196 2244
 ### Check auth configuration
... ...
@@ -2422,6 +2502,95 @@ Display system-wide information
2422 2422
 -   **200** – no error
2423 2423
 -   **500** – server error
2424 2424
 
2425
+### Show docker data usage information
2426
+
2427
+`GET /system/df`
2428
+
2429
+Return docker data usage information
2430
+
2431
+**Example request**:
2432
+
2433
+    GET /system/df HTTP/1.1
2434
+
2435
+**Example response**:
2436
+
2437
+	{
2438
+	    "LayersSize": 1092588,
2439
+	    "Images": [
2440
+	        {
2441
+	            "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2442
+	            "ParentId": "",
2443
+	            "RepoTags": [
2444
+	                "busybox:latest"
2445
+	            ],
2446
+	            "RepoDigests": [
2447
+	                "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2448
+	            ],
2449
+	            "Created": 1466724217,
2450
+	            "Size": 1092588,
2451
+	            "SharedSize": 0,
2452
+	            "VirtualSize": 1092588,
2453
+	            "Labels": {},
2454
+	            "Containers": 1
2455
+	        }
2456
+	    ],
2457
+	    "Containers": [
2458
+	        {
2459
+	            "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148",
2460
+	            "Names": [
2461
+	                "/top"
2462
+	            ],
2463
+	            "Image": "busybox",
2464
+	            "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2465
+	            "Command": "top",
2466
+	            "Created": 1472592424,
2467
+	            "Ports": [],
2468
+	            "SizeRootFs": 1092588,
2469
+	            "Labels": {},
2470
+	            "State": "exited",
2471
+	            "Status": "Exited (0) 56 minutes ago",
2472
+	            "HostConfig": {
2473
+	                "NetworkMode": "default"
2474
+	            },
2475
+	            "NetworkSettings": {
2476
+	                "Networks": {
2477
+	                    "bridge": {
2478
+	                        "IPAMConfig": null,
2479
+	                        "Links": null,
2480
+	                        "Aliases": null,
2481
+	                        "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92",
2482
+	                        "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a",
2483
+	                        "Gateway": "172.18.0.1",
2484
+	                        "IPAddress": "172.18.0.2",
2485
+	                        "IPPrefixLen": 16,
2486
+	                        "IPv6Gateway": "",
2487
+	                        "GlobalIPv6Address": "",
2488
+	                        "GlobalIPv6PrefixLen": 0,
2489
+	                        "MacAddress": "02:42:ac:12:00:02"
2490
+	                    }
2491
+	                }
2492
+	            },
2493
+	            "Mounts": []
2494
+	        }
2495
+	    ],
2496
+        "Volumes": [
2497
+                {
2498
+                    "Name": "my-volume",
2499
+                    "Driver": "local",
2500
+                    "Mountpoint": "",
2501
+                    "Labels": null,
2502
+                    "Scope": "",
2503
+                    "Size": 0,
2504
+                    "RefCount": 0
2505
+                }
2506
+        ]
2507
+	}
2508
+
2509
+**Status codes**:
2510
+
2511
+-   **200** – no error
2512
+-   **500** – server error
2513
+
2425 2514
 ### Show the docker version information
2426 2515
 
2427 2516
 `GET /version`
... ...
@@ -3224,6 +3393,38 @@ Instruct the driver to remove the volume (`name`).
3224 3224
 -   **409** - volume is in use and cannot be removed
3225 3225
 -   **500** - server error
3226 3226
 
3227
+### Prune unused volumes
3228
+
3229
+`POST /volumes/prune`
3230
+
3231
+Delete unused volumes
3232
+
3233
+**Example request**:
3234
+
3235
+    POST /volumes/prune HTTP/1.1
3236
+    Content-Type: application/json
3237
+
3238
+    {
3239
+    }
3240
+
3241
+**Example response**:
3242
+
3243
+    HTTP/1.1 200 OK
3244
+    Content-Type: application/json
3245
+
3246
+	{
3247
+	    "VolumesDeleted": [
3248
+	        "my-volume"
3249
+	    ],
3250
+	    "SpaceReclaimed": 42
3251
+	}
3252
+
3253
+**Status codes**:
3254
+
3255
+-   **200** – no error
3256
+-   **500** – server error
3257
+
3258
+
3227 3259
 ## 3.5 Networks
3228 3260
 
3229 3261
 ### List networks