Browse code

Add documentation for container, volume, image and system prune subcommands

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

Kenfe-Mickael Laventure authored on 2016/09/01 01:57:32
Showing 6 changed files
... ...
@@ -1565,11 +1565,11 @@ Upload a tar archive to be extracted to a path in the filesystem of container
1565 1565
 - **500** – server error
1566 1566
 
1567 1567
 
1568
-### Prune unused containers
1568
+### Prune stopped containers
1569 1569
 
1570 1570
 `POST /containers/prune`
1571 1571
 
1572
-Delete unused containers
1572
+Delete stopped containers
1573 1573
 
1574 1574
 **Example request**:
1575 1575
 
... ...
@@ -1584,12 +1584,12 @@ Delete unused containers
1584 1584
     HTTP/1.1 200 OK
1585 1585
     Content-Type: application/json
1586 1586
 
1587
-	{
1588
-	    "ContainersDeleted": [
1589
-	        "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148"
1590
-	    ],
1591
-	    "SpaceReclaimed": 109
1592
-	}
1587
+    {
1588
+        "ContainersDeleted": [
1589
+            "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148"
1590
+        ],
1591
+        "SpaceReclaimed": 109
1592
+    }
1593 1593
 
1594 1594
 **Status codes**:
1595 1595
 
... ...
@@ -2235,7 +2235,7 @@ Delete unused images
2235 2235
     Content-Type: application/json
2236 2236
 
2237 2237
     {
2238
-        "DanglingOnly": false,
2238
+        "DanglingOnly": false
2239 2239
     }
2240 2240
 
2241 2241
 **Example response**:
... ...
@@ -2243,27 +2243,27 @@ Delete unused images
2243 2243
     HTTP/1.1 200 OK
2244 2244
     Content-Type: application/json
2245 2245
 
2246
-	{
2247
-	    "ImagesDeleted": [
2248
-	        {
2249
-	            "Untagged": "busybox:latest"
2250
-	        },
2251
-	        {
2252
-	            "Untagged": "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2253
-	        },
2254
-	        {
2255
-	            "Deleted": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749"
2256
-	        },
2257
-	        {
2258
-	            "Deleted": "sha256:8ac8bfaff55af948c796026ee867448c5b5b5d9dd3549f4006d9759b25d4a893"
2259
-	        }
2260
-	    ],
2261
-	    "SpaceReclaimed": 1092588
2262
-	}
2246
+    {
2247
+        "ImagesDeleted": [
2248
+            {
2249
+                "Untagged": "busybox:latest"
2250
+            },
2251
+            {
2252
+                "Untagged": "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2253
+            },
2254
+            {
2255
+                "Deleted": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749"
2256
+            },
2257
+            {
2258
+                "Deleted": "sha256:8ac8bfaff55af948c796026ee867448c5b5b5d9dd3549f4006d9759b25d4a893"
2259
+            }
2260
+        ],
2261
+        "SpaceReclaimed": 1092588
2262
+    }
2263 2263
 
2264 2264
 **JSON parameters**:
2265 2265
 
2266
-- **DanglingOnly**: if true only delete unused AND untagged images
2266
+- **DanglingOnly**: if `true` only delete unused *and* untagged images. Default to `false` if omitted
2267 2267
 
2268 2268
 **Status codes**:
2269 2269
 
... ...
@@ -2514,65 +2514,65 @@ Return docker data usage information
2514 2514
 
2515 2515
 **Example response**:
2516 2516
 
2517
-	{
2518
-	    "LayersSize": 1092588,
2519
-	    "Images": [
2520
-	        {
2521
-	            "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2522
-	            "ParentId": "",
2523
-	            "RepoTags": [
2524
-	                "busybox:latest"
2525
-	            ],
2526
-	            "RepoDigests": [
2527
-	                "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2528
-	            ],
2529
-	            "Created": 1466724217,
2530
-	            "Size": 1092588,
2531
-	            "SharedSize": 0,
2532
-	            "VirtualSize": 1092588,
2533
-	            "Labels": {},
2534
-	            "Containers": 1
2535
-	        }
2536
-	    ],
2537
-	    "Containers": [
2538
-	        {
2539
-	            "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148",
2540
-	            "Names": [
2541
-	                "/top"
2542
-	            ],
2543
-	            "Image": "busybox",
2544
-	            "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2545
-	            "Command": "top",
2546
-	            "Created": 1472592424,
2547
-	            "Ports": [],
2548
-	            "SizeRootFs": 1092588,
2549
-	            "Labels": {},
2550
-	            "State": "exited",
2551
-	            "Status": "Exited (0) 56 minutes ago",
2552
-	            "HostConfig": {
2553
-	                "NetworkMode": "default"
2554
-	            },
2555
-	            "NetworkSettings": {
2556
-	                "Networks": {
2557
-	                    "bridge": {
2558
-	                        "IPAMConfig": null,
2559
-	                        "Links": null,
2560
-	                        "Aliases": null,
2561
-	                        "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92",
2562
-	                        "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a",
2563
-	                        "Gateway": "172.18.0.1",
2564
-	                        "IPAddress": "172.18.0.2",
2565
-	                        "IPPrefixLen": 16,
2566
-	                        "IPv6Gateway": "",
2567
-	                        "GlobalIPv6Address": "",
2568
-	                        "GlobalIPv6PrefixLen": 0,
2569
-	                        "MacAddress": "02:42:ac:12:00:02"
2570
-	                    }
2571
-	                }
2572
-	            },
2573
-	            "Mounts": []
2574
-	        }
2575
-	    ],
2517
+    {
2518
+        "LayersSize": 1092588,
2519
+        "Images": [
2520
+            {
2521
+                "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2522
+                "ParentId": "",
2523
+                "RepoTags": [
2524
+                    "busybox:latest"
2525
+                ],
2526
+                "RepoDigests": [
2527
+                    "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
2528
+                ],
2529
+                "Created": 1466724217,
2530
+                "Size": 1092588,
2531
+                "SharedSize": 0,
2532
+                "VirtualSize": 1092588,
2533
+                "Labels": {},
2534
+                "Containers": 1
2535
+            }
2536
+        ],
2537
+        "Containers": [
2538
+            {
2539
+                "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148",
2540
+                "Names": [
2541
+                    "/top"
2542
+                ],
2543
+                "Image": "busybox",
2544
+                "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
2545
+                "Command": "top",
2546
+                "Created": 1472592424,
2547
+                "Ports": [],
2548
+                "SizeRootFs": 1092588,
2549
+                "Labels": {},
2550
+                "State": "exited",
2551
+                "Status": "Exited (0) 56 minutes ago",
2552
+                "HostConfig": {
2553
+                    "NetworkMode": "default"
2554
+                },
2555
+                "NetworkSettings": {
2556
+                    "Networks": {
2557
+                        "bridge": {
2558
+                            "IPAMConfig": null,
2559
+                            "Links": null,
2560
+                            "Aliases": null,
2561
+                            "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92",
2562
+                            "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a",
2563
+                            "Gateway": "172.18.0.1",
2564
+                            "IPAddress": "172.18.0.2",
2565
+                            "IPPrefixLen": 16,
2566
+                            "IPv6Gateway": "",
2567
+                            "GlobalIPv6Address": "",
2568
+                            "GlobalIPv6PrefixLen": 0,
2569
+                            "MacAddress": "02:42:ac:12:00:02"
2570
+                        }
2571
+                    }
2572
+                },
2573
+                "Mounts": []
2574
+            }
2575
+        ],
2576 2576
         "Volumes": [
2577 2577
                 {
2578 2578
                     "Name": "my-volume",
... ...
@@ -2584,7 +2584,7 @@ Return docker data usage information
2584 2584
                     "RefCount": 0
2585 2585
                 }
2586 2586
         ]
2587
-	}
2587
+    }
2588 2588
 
2589 2589
 **Status codes**:
2590 2590
 
... ...
@@ -3412,12 +3412,12 @@ Delete unused volumes
3412 3412
     HTTP/1.1 200 OK
3413 3413
     Content-Type: application/json
3414 3414
 
3415
-	{
3416
-	    "VolumesDeleted": [
3417
-	        "my-volume"
3418
-	    ],
3419
-	    "SpaceReclaimed": 42
3420
-	}
3415
+    {
3416
+        "VolumesDeleted": [
3417
+            "my-volume"
3418
+        ],
3419
+        "SpaceReclaimed": 42
3420
+    }
3421 3421
 
3422 3422
 **Status codes**:
3423 3423
 
3424 3424
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+<!--[metadata]>
1
+title = "container prune"
2
+description = "Remove all stopped containers"
3
+keywords = [container, prune, delete, remove]
4
+[menu.main]
5
+parent = "smn_cli"
6
+<![end-metadata]-->
7
+
8
+# container prune
9
+
10
+```markdown
11
+Usage:	docker container prune
12
+
13
+Remove all stopped containers
14
+
15
+Options:
16
+  -f, --force   Do not prompt for confirmation
17
+      --help    Print usage
18
+```
19
+
20
+Example output:
21
+
22
+```bash
23
+$ docker container prune
24
+WARNING! This will remove all stopped containers.
25
+Are you sure you want to continue? [y/N] y
26
+Deleted Containers:
27
+4a7f7eebae0f63178aff7eb0aa39cd3f0627a203ab2df258c1a00b456cf20063
28
+f98f9c2aa1eaf727e4ec9c0283bc7d4aa4762fbdba7f26191f26c97f64090360
29
+
30
+Total reclaimed space: 212 B
31
+```
32
+
33
+## Related information
34
+
35
+* [system df](system_df.md)
36
+* [volume prune](container_prune.md)
37
+* [image prune](container_prune.md)
38
+* [system prune](system_prune.md)
0 39
new file mode 100644
... ...
@@ -0,0 +1,65 @@
0
+<!--[metadata]>
1
+title = "image prune"
2
+description = "Remove all stopped images"
3
+keywords = [image, prune, delete, remove]
4
+[menu.main]
5
+parent = "smn_cli"
6
+<![end-metadata]-->
7
+
8
+# image prune
9
+
10
+```markdown
11
+Usage:	docker image prune
12
+
13
+Remove unused images
14
+
15
+Options:
16
+  -a, --all     Remove all unused images, not just dangling ones
17
+  -f, --force   Do not prompt for confirmation
18
+      --help    Print usage
19
+```
20
+
21
+Remove all dangling images. If `-a` is specified, will also remove all images not referenced by any container.
22
+
23
+Example output:
24
+
25
+```bash
26
+$ docker image prune -a
27
+WARNING! This will remove all images without at least one container associated to them.
28
+Are you sure you want to continue? [y/N] y
29
+Deleted Images:
30
+untagged: alpine:latest
31
+untagged: alpine@sha256:3dcdb92d7432d56604d4545cbd324b14e647b313626d99b889d0626de158f73a
32
+deleted: sha256:4e38e38c8ce0b8d9041a9c4fefe786631d1416225e13b0bfe8cfa2321aec4bba
33
+deleted: sha256:4fe15f8d0ae69e169824f25f1d4da3015a48feeeeebb265cd2e328e15c6a869f
34
+untagged: alpine:3.3
35
+untagged: alpine@sha256:4fa633f4feff6a8f02acfc7424efd5cb3e76686ed3218abf4ca0fa4a2a358423
36
+untagged: my-jq:latest
37
+deleted: sha256:ae67841be6d008a374eff7c2a974cde3934ffe9536a7dc7ce589585eddd83aff
38
+deleted: sha256:34f6f1261650bc341eb122313372adc4512b4fceddc2a7ecbb84f0958ce5ad65
39
+deleted: sha256:cf4194e8d8db1cb2d117df33f2c75c0369c3a26d96725efb978cc69e046b87e7
40
+untagged: my-curl:latest
41
+deleted: sha256:b2789dd875bf427de7f9f6ae001940073b3201409b14aba7e5db71f408b8569e
42
+deleted: sha256:96daac0cb203226438989926fc34dd024f365a9a8616b93e168d303cfe4cb5e9
43
+deleted: sha256:5cbd97a14241c9cd83250d6b6fc0649833c4a3e84099b968dd4ba403e609945e
44
+deleted: sha256:a0971c4015c1e898c60bf95781c6730a05b5d8a2ae6827f53837e6c9d38efdec
45
+deleted: sha256:d8359ca3b681cc5396a4e790088441673ed3ce90ebc04de388bfcd31a0716b06
46
+deleted: sha256:83fc9ba8fb70e1da31dfcc3c88d093831dbd4be38b34af998df37e8ac538260c
47
+deleted: sha256:ae7041a4cc625a9c8e6955452f7afe602b401f662671cea3613f08f3d9343b35
48
+deleted: sha256:35e0f43a37755b832f0bbea91a2360b025ee351d7309dae0d9737bc96b6d0809
49
+deleted: sha256:0af941dd29f00e4510195dd00b19671bc591e29d1495630e7e0f7c44c1e6a8c0
50
+deleted: sha256:9fc896fc2013da84f84e45b3096053eb084417b42e6b35ea0cce5a3529705eac
51
+deleted: sha256:47cf20d8c26c46fff71be614d9f54997edacfe8d46d51769706e5aba94b16f2b
52
+deleted: sha256:2c675ee9ed53425e31a13e3390bf3f539bf8637000e4bcfbb85ee03ef4d910a1
53
+
54
+Total reclaimed space: 16.43 MB
55
+```
56
+
57
+## Related information
58
+
59
+* [system df](system_df.md)
60
+* [container prune](container_prune.md)
61
+* [volume prune](container_prune.md)
62
+* [system prune](system_prune.md)
0 63
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+<!--[metadata]>
1
+title = "system df"
2
+description = "The system df command description and usage"
3
+keywords = [system, data, usage, disk]
4
+[menu.main]
5
+parent = "smn_cli"
6
+<![end-metadata]-->
7
+
8
+# system df
9
+
10
+```markdown
11
+Usage:	docker system df [OPTIONS]
12
+
13
+Show docker filesystem usage
14
+
15
+Options:
16
+      --help      Print usage
17
+  -v, --verbose   Show detailed information on space usage
18
+```
19
+
20
+The `docker system df` command displays information regarding the
21
+amount of disk space used by the docker daemon.
22
+
23
+By default the command will just show a summary of the data used:
24
+```bash
25
+$ docker system df
26
+TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
27
+Images              5                   2                   16.43 MB            11.63 MB (70%)
28
+Containers          2                   0                   212 B               212 B (100%)
29
+Local Volumes       2                   1                   36 B                0 B (0%)
30
+```
31
+
32
+A more detailed view can be requested using the `-v, --verbose` flag:
33
+```bash
34
+$ docker system df -v
35
+Images space usage:
36
+
37
+REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE                SHARED SIZE         UNIQUE SIZE         CONTAINERS
38
+my-curl             latest              b2789dd875bf        6 minutes ago       11 MB               11 MB               5 B                 0
39
+my-jq               latest              ae67841be6d0        6 minutes ago       9.623 MB            8.991 MB            632.1 kB            0
40
+<none>              <none>              a0971c4015c1        6 minutes ago       11 MB               11 MB               0 B                 0
41
+alpine              latest              4e38e38c8ce0        9 weeks ago         4.799 MB            0 B                 4.799 MB            1
42
+alpine              3.3                 47cf20d8c26c        9 weeks ago         4.797 MB            4.797 MB            0 B                 1
43
+
44
+Containers space usage:
45
+
46
+CONTAINER ID        IMAGE               COMMAND             LOCAL VOLUMES       SIZE                CREATED             STATUS                      NAMES
47
+4a7f7eebae0f        alpine:latest       "sh"                1                   0 B                 16 minutes ago      Exited (0) 5 minutes ago    hopeful_yalow
48
+f98f9c2aa1ea        alpine:3.3          "sh"                1                   212 B               16 minutes ago      Exited (0) 48 seconds ago   anon-vol
49
+
50
+Local Volumes space usage:
51
+
52
+NAME                                                               LINKS               SIZE
53
+07c7bdf3e34ab76d921894c2b834f073721fccfbbcba792aa7648e3a7a664c2e   2                   36 B
54
+my-named-vol                                                       0                   0 B
55
+```
56
+
57
+* `SHARED SIZE` is the amount of space that an image shares with another one (i.e. their common data)
58
+* `UNIQUE SIZE` is the amount of space that is only used by a given image
59
+* `SIZE` is the virtual size of the image, it is the sum of `SHARED SIZE` and `UNIQUE SIZE`
60
+
61
+## Related Information
62
+* [system prune](system_prune.md)
63
+* [container prune](container_prune.md)
64
+* [volume prune](volume_prune.md)
65
+* [image prune](image_prune.md)
0 66
new file mode 100644
... ...
@@ -0,0 +1,70 @@
0
+<!--[metadata]>
1
+title = "system prune"
2
+description = "Remove unused data"
3
+keywords = [system, prune, delete, remove]
4
+[menu.main]
5
+parent = "smn_cli"
6
+<![end-metadata]-->
7
+
8
+# system prune
9
+
10
+```markdown
11
+Usage:	docker system prune COMMAND
12
+
13
+Delete unused data
14
+
15
+Options:
16
+  -a, --all     Remove all unused images not just dangling ones
17
+  -f, --force   Do not prompt for confirmation
18
+      --help    Print usage
19
+```
20
+
21
+Remove all unused containers, volumes and images (both dangling and unreferenced).
22
+
23
+Example output:
24
+
25
+```bash
26
+$ docker system prune -a
27
+WARNING! This will remove:
28
+	- all stopped containers
29
+	- all volumes not used by at least one container
30
+	- all images without at least one container associated to them
31
+Are you sure you want to continue? [y/N] y
32
+Deleted Containers:0998aa37185a1a7036b0e12cf1ac1b6442dcfa30a5c9650a42ed5010046f195b
33
+73958bfb884fa81fa4cc6baf61055667e940ea2357b4036acbbe25a60f442a4d
34
+
35
+Deleted Volumes:
36
+named-vol
37
+
38
+Deleted Images:
39
+untagged: my-curl:latest
40
+deleted: sha256:7d88582121f2a29031d92017754d62a0d1a215c97e8f0106c586546e7404447d
41
+deleted: sha256:dd14a93d83593d4024152f85d7c63f76aaa4e73e228377ba1d130ef5149f4d8b
42
+untagged: alpine:3.3
43
+deleted: sha256:695f3d04125db3266d4ab7bbb3c6b23aa4293923e762aa2562c54f49a28f009f
44
+untagged: alpine:latest
45
+deleted: sha256:ee4603260daafe1a8c2f3b78fd760922918ab2441cbb2853ed5c439e59c52f96
46
+deleted: sha256:9007f5987db353ec398a223bc5a135c5a9601798ba20a1abba537ea2f8ac765f
47
+deleted: sha256:71fa90c8f04769c9721459d5aa0936db640b92c8c91c9b589b54abd412d120ab
48
+deleted: sha256:bb1c3357b3c30ece26e6604aea7d2ec0ace4166ff34c3616701279c22444c0f3
49
+untagged: my-jq:latest
50
+deleted: sha256:6e66d724542af9bc4c4abf4a909791d7260b6d0110d8e220708b09e4ee1322e1
51
+deleted: sha256:07b3fa89d4b17009eb3988dfc592c7d30ab3ba52d2007832dffcf6d40e3eda7f
52
+deleted: sha256:3a88a5c81eb5c283e72db2dbc6d65cbfd8e80b6c89bb6e714cfaaa0eed99c548
53
+
54
+Total reclaimed space: 13.5 MB
55
+```
56
+
57
+## Related information
58
+
59
+* [volume create](volume_create.md)
60
+* [volume ls](volume_ls.md)
61
+* [volume inspect](volume_inspect.md)
62
+* [volume rm](volume_rm.md)
63
+* [Understand Data Volumes](../../tutorials/dockervolumes.md)
64
+* [system df](system_df.md)
65
+* [container prune](container_prune.md)
66
+* [image prune](container_prune.md)
67
+* [system prune](system_prune.md)
0 68
new file mode 100644
... ...
@@ -0,0 +1,48 @@
0
+<!--[metadata]>
1
+title = "volume prune"
2
+description = "Remove unused volumes"
3
+keywords = [volume, prune, delete]
4
+[menu.main]
5
+parent = "smn_cli"
6
+<![end-metadata]-->
7
+
8
+# volume prune
9
+
10
+```markdown
11
+Usage:	docker volume prune
12
+
13
+Remove all unused volumes
14
+
15
+Options:
16
+  -f, --force   Do not prompt for confirmation
17
+      --help    Print usage
18
+```
19
+
20
+Remove all unused volumes. Unused volumes are those which are not referenced by any containers
21
+
22
+Example output:
23
+
24
+```bash
25
+$ docker volume prune
26
+WARNING! This will remove all volumes not used by at least one container.
27
+Are you sure you want to continue? [y/N] y
28
+Deleted Volumes:
29
+07c7bdf3e34ab76d921894c2b834f073721fccfbbcba792aa7648e3a7a664c2e
30
+my-named-vol
31
+
32
+Total reclaimed space: 36 B
33
+```
34
+
35
+## Related information
36
+
37
+* [volume create](volume_create.md)
38
+* [volume ls](volume_ls.md)
39
+* [volume inspect](volume_inspect.md)
40
+* [volume rm](volume_rm.md)
41
+* [Understand Data Volumes](../../tutorials/dockervolumes.md)
42
+* [system df](system_df.md)
43
+* [container prune](container_prune.md)
44
+* [image prune](container_prune.md)
45
+* [system prune](system_prune.md)