1. 程式人生 > >KEEP LOOKING DON'T SETTLE

KEEP LOOKING DON'T SETTLE

說明

由於我們使用Docker Swarm特性與Jenkins進行自動化部署升級服務,隨著不斷的升級會產生大量的未清理的老版本映象常駐在本地磁碟之中,而這些映象其實都已經沒什麼作用了,所以需要對其進行清理,所以本篇主要記錄一些清理的方式,以便查閱。

清理方式

官方其實給出了一個類似“一鍵清除”的方案,只需要一行命令既可以對所有未使用的容器與捲進行清理,但我發現此命令還是會存在某些缺陷,比如依然會有一些映象無法徹底清理,我個人建議還是手動處理較好。

官方做法 (不太推薦)

以下命令會強制執行清理操作,如果需要檢視Docker耗費磁碟的資訊,請使用 docker system df

進行檢視。

docker system prune -f

手動做法(推薦做法)

清理映象

手動清理映象的操作我主要用到了一些格式化從操作,如:指定映象某個之前的TAG,然後再通過獨立過濾某個映象,等;更多格式化操作參考文件:點選這裡

docker rmi \
$( \
docker images \
-f before='nh/backend-uat:91' \
-f reference="nh/backend-uat" \
-q \
) \

清理映象(使用TAG名稱)

docker rmi \
$( \
docker images \
-f before='nh/backend-uat:91'
\
-f reference="nh/backend-uat" \ | awk '/?*backend-uat*/{print $1 ":" $2}' \ ) \

引數

  • before - 指定哪個TAG之前的所有映象
  • reference - 過濾某個標識的映象

清理退出的容器

docker rm $(docker ps -q -f status=exited)

status取值範圍

  • status=running
  • status=exited

定時任務結合

手動方案操作可以結合定時任務進行定製化按需求清理,編寫 crontab 指令碼進行清理的工作就好了。

參考資料

相關推薦

KEEP LOOKING DON'T SETTLE

說明 由於我們使用Docker Swarm特性與Jenkins進行自動化部署升級服務,隨著不斷的升級會產生大量的未清理的老版本映象常駐在本地磁碟之中,而這些映象其實都已經沒什麼作用了,所以需要對其進行清理,所以本篇主要記錄一些清理的方式,以便查閱。 清理

Don't rush and never settle. If it's meant to be, it will be.

主體程式碼 class MyObject{ //這是具體的實現方法 } class MyThread extends Thread{ @Override public void run(){ System.o

Don't Peek: Deep Learning without looking … at test data

What is the purpose of a theory? To explain why something works. But to also make predictions–testable predictions. Recently we introduced the theory of Im

WampServer出現You dont have permission to access/on this server提示

ron 服務 mps all -m 如何 onf sta highlight WampServer出現You don’t have permission to access/on this server提示 本地搭建WampServer,輸入http://127.0.0

Wireshark 抓包遇到 you dont have permission to capture on that device mac 錯誤的解決方案

打開 min 遇到 分享 hone eas watermark tail 錯誤 Wireshark 抓包遇到 you don’t have permission to capture on that device mac 錯誤的解決方案 上次有篇博客講了如何利用wires

mac osx下apache下的坑: you dont have permission to access / on this server

pos require tor director div http localhost mce pan 在Mac下Apache修改默認站點的目錄時,遇到403錯誤, you don’t have permission to access / on this server

apache2.4 You dont have permission to access / on

mission index ESS per 2.4 system win follow mis apache2.4 You don‘t have permission to access / on this server. 在配置完apache2.4conf/extra/h

ALIENTEK 的 ESP8266 WiFi Module 刷入韌體後出現dont use rtc mem data錯誤或者ESP8266開啟串列埠不停出現亂碼的解決方案

ESP8266 WiFi Module 刷入韌體後出現don’t use rtc mem data 出現問題: 重新整理新的韌體後,出現錯誤提示:don’t use rtc mem data 或各種讀寫地址錯誤。 1、A fatal error occurred

Don't Trust, Verify

Jan 又帶來了一篇對區塊鏈節點的思考,文字簡潔,沒有數學公式,沒有計算機演算法,更沒有玄學,對於大家來說,這篇文章可以作為理解區塊鏈的試金石。 1 角色 我們都知道,區塊鏈網路中的節點有不同的角色。例如: 出塊節點 出塊節點負責打包交易,生產區塊。出塊

FUCK!!! nginx in ubuntu and yum don't support ubuntu

How to install nginx in ubuntu 18.0? it very easy ,please follw: step1:   sudo apt  install ngnix over!!!!! AND wo can try to build st

安裝GHOST系統提示Units specified don't exist SHSUCDX can't install

我們在Ghost安裝系統時出現Units specified don't exist. SHSUCDX can't install.錯誤 具體原因如下:   第一,硬碟分割槽有問題,沒有正確分割槽或者分割槽之後沒有被啟用。   第二,硬碟本身有問題,或者硬碟沒有被正

PHPstudy 區域網其他主機訪問403(You don`t have permission to......)

PHPstudy 區域網其他主機訪問403(You don`t have permission to…) DVWA這個測試環境以前裝在Apache上,但是Apache複雜的配置環境實在是對新手不友好,所以換成了PHPstudy(不得不說,確實很方便,但也是偶爾存

Dont Test, Verify. | 哪個故事真正符合你對形式化驗證的想象?

從誕生至今,形式化驗證(Formal Verification)方法一直與“小眾、冷門”等字眼掛鉤。有人說形式化驗證方法是一種“軍用級別”的防黑客手段,更是為這項技術增添了一絲神祕感。 究竟什麼是形式化驗證方法? 維基百科對形式化驗證的解釋是這樣的: 在計算機

10 Useful Github Features You Probably Dont Know

10 Useful Github Features You Probably Don’t Know https://medium.com/@aqeelakhtar.web/10-useful-github-features-you-probably-dont-know-c33352d0

You Dont Understand Bitcoin Because You Think Money Is Real

Bitcoin is an illusion, a mass hallucination, so one hears. It’s just numbers in cyberspace, a mirage, insubstantial as a soap bubble. Bitcoin is not backe

Dont write boilerplate, use scriapt

A good programmer never writes boilerplate code. Instead he/she recognizes the repetitive patterns after writing some, or even before it gets written,

Dont use iOS meta tags irresponsibly in your Progressive Web Apps

Don’t use iOS meta tags irresponsibly in your Progressive Web AppsIn the last months I’ve seen several apps creating what is known as a “Progressive Web Ap

Don't let your dreams be dreams

什麼是VLAN?                                                                                      一個VLA

【Steve_Abelieve】Don't worry too much about the ambiguous future, just make effort for explicit being present.

Don't worry too much about the ambiguous future, just make effort for explicit being present.

Ask HN: Why companies don't pay candidates for showing up at their interview?

Interviewing is very painful and time consuming for candidates, plus, companies spend a lot of money for that. Why companies don't pay candidates for showi