?
This document uses PHP Chinese website manual Release
刪除未使用的數(shù)據(jù)
docker system prune [OPTIONS]
名字,簡(jiǎn)寫(xiě) | 默認(rèn) | 描述 |
---|---|---|
--all, -a | 假 | 刪除所有未使用的圖像,而不僅僅是掛起的圖像 |
--filter | 提供過(guò)濾器值(例如'label = =') | |
--force, -f | 假 | 不要提示確認(rèn) |
--volumes | 假 | 修剪卷 |
命令 | 描述 |
---|---|
docker system | 管理Docker |
命令 | 描述 |
---|---|
docker system df | 顯示docker磁盤(pán)使用情況 |
docker system events | 從服務(wù)器獲取實(shí)時(shí)事件 |
docker system info | 顯示系統(tǒng)范圍的信息 |
docker system prune | 刪除未使用的數(shù)據(jù) |
刪除所有未使用的容器、卷、網(wǎng)絡(luò)和圖像(---同時(shí)掛起和未引用的)。
$ docker system prune -a WARNING! This will remove:- all stopped containers- all volumes not used by at least one container- all networks not used by at least one container- all images without at least one container associated to them Are you sure you want to continue? [y/N] y Deleted Containers:0998aa37185a1a7036b0e12cf1ac1b6442dcfa30a5c9650a42ed5010046f195b 73958bfb884fa81fa4cc6baf61055667e940ea2357b4036acbbe25a60f442a4d Deleted Volumes:named-vol Deleted Images:untagged: my-curl:latest deleted: sha256:7d88582121f2a29031d92017754d62a0d1a215c97e8f0106c586546e7404447d deleted: sha256:dd14a93d83593d4024152f85d7c63f76aaa4e73e228377ba1d130ef5149f4d8b untagged: alpine:3.3deleted: sha256:695f3d04125db3266d4ab7bbb3c6b23aa4293923e762aa2562c54f49a28f009f untagged: alpine:latest deleted: sha256:ee4603260daafe1a8c2f3b78fd760922918ab2441cbb2853ed5c439e59c52f96 deleted: sha256:9007f5987db353ec398a223bc5a135c5a9601798ba20a1abba537ea2f8ac765f deleted: sha256:71fa90c8f04769c9721459d5aa0936db640b92c8c91c9b589b54abd412d120ab deleted: sha256:bb1c3357b3c30ece26e6604aea7d2ec0ace4166ff34c3616701279c22444c0f3 untagged: my-jq:latest deleted: sha256:6e66d724542af9bc4c4abf4a909791d7260b6d0110d8e220708b09e4ee1322e1 deleted: sha256:07b3fa89d4b17009eb3988dfc592c7d30ab3ba52d2007832dffcf6d40e3eda7f deleted: sha256:3a88a5c81eb5c283e72db2dbc6d65cbfd8e80b6c89bb6e714cfaaa0eed99c548 Total reclaimed space: 13.5 MB
過(guò)濾標(biāo)志(-f
or --filter
) 格式為“key=value”。如果有多個(gè)篩選器,則傳遞多個(gè)標(biāo)志 (例如 --filter "foo=bar" --filter "bif=baz"
)
目前支持的過(guò)濾器是:
until(<timestamp>
) - 僅刪除在給定時(shí)間戳之前創(chuàng)建的容器,圖像和網(wǎng)絡(luò)
label (label=<key>
, label=<key>=<value>
, label!=<key>
,或label!=<key>=<value>
)-僅刪除帶有%的容器、圖像、網(wǎng)絡(luò)和卷(以防萬(wàn)一label!=...
使用)指定的標(biāo)簽。
該until
過(guò)濾器可以是Unix的時(shí)間戳,日期格式的時(shí)間戳,或持續(xù)時(shí)間字符串(例如,去10m
,1h30m
)計(jì)算相對(duì)于守護(hù)機(jī)器的時(shí)間。支持的格式為日期格式時(shí)間戳包括RFC3339Nano,RFC3339, ,2006-01-02T15:04:05
,2006-01-02T15:04:05.999999999
,2006-01-02Z07:00
和2006-01-02
。如果您在時(shí)間戳結(jié)束時(shí)未提供時(shí)區(qū)偏移Z
或+-00:00
時(shí)區(qū)偏移,則將使用守護(hù)程序上的本地時(shí)區(qū)。在提供Unix時(shí)間戳?xí)r輸入seconds.nanoseconds,其中seconds是自1970年1月1日(UTC/GMT午夜)以來(lái)經(jīng)過(guò)的秒數(shù),不包括閏秒(又名Unix紀(jì)元或Unix時(shí)間)以及可選的.nanoseconds字段是一秒不超過(guò)九位數(shù)的一小部分。
大label
過(guò)濾器接受兩種格式。一個(gè)是label=...
(label=<key>
或label=<key>=<value>
),它使用指定的標(biāo)簽刪除容器、圖像、網(wǎng)絡(luò)和卷。另一種格式是label!=...
(label!=<key>
或label!=<key>=<value>
),它在沒(méi)有指定標(biāo)簽的情況下刪除容器、圖像、網(wǎng)絡(luò)和卷。