升級docker images, 舊版images變成none
最近升級moodle到4.0.1版本, 發現有問題, 想用回舊版, 發現舊版的變成 moodle:<none> , 這樣一來不就不能使用舊版了, 後來發現只要知道舊版images id , 就可以改成想要的tag, 也就能繼續使用了
docker tag <images id> <images name>:x.x
docker tag 43b9473f010d bitnami/moodle:3.10
最近升級moodle到4.0.1版本, 發現有問題, 想用回舊版, 發現舊版的變成 moodle:<none> , 這樣一來不就不能使用舊版了, 後來發現只要知道舊版images id , 就可以改成想要的tag, 也就能繼續使用了
docker tag <images id> <images name>:x.x
docker tag 43b9473f010d bitnami/moodle:3.10
前陣子發現restic備份的好處, 尤其拿來當離線備份.
IT同事進行離線備份時, 有意無意被老闆路過, 看到滿滿備份畫面咻咻跑來跑去, 充滿了儀式感.
老闆開心, IT同仁也有成就感.
restic指令備份, 不夠自動化, 為了讓IT同事做少少的工作, 又讓IT同事與其他路過的同事覺得好專業, 因此寫了簡單的restic backup script , 可以協助掛載來源目錄, 掛載後,進行restic備份.
檔案請到這裡下載, 下載後請看readme.md檔案
先前寫了一篇centos7安裝opendkim+postfix 這只是單一網域, 若要多個網域,實在是很麻煩
google爬文爬到一篇文章,有神人寫了自動產生相關文件的shell script , 我稍微修改一下, 就能很方便產生相關文件.
#centos 7
yum install opendkim
#centos 8 , rocky linux 8
yum install opendkim opendkim-tools
除非有log備份需要, 否則log太大, 必須抓出來, 然後清 0 (cat /dev/null > xxx.log)
find /docker/images/ -name *.log -ls | sort -r -n -k7
或是
find /docker/images/ -name *.log -type f -size +1000000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro assaflavie/runlike <容器名稱>
docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod <容器名稱>
但是這種方式屬於 reverse 方式, 跟原本會有一些失真,但真的沒留下當初執行的指令, 也只好使用這種方式了
定義一個陣列
declare -a source_dirs_weekly=("2-w3-portal" "2-w3-opt" "2-w3-jtrac" "200-printer" "194-easyflow" "229-fileserver")
也可以醬
declare -a source_dirs_weekly=(
"2-w3-portal"
"2-w3-opt"
"2-w3-jtrac"
"200-printer"
"194-easyflow"
"229-fileserver"
)
要取出資料,可以參考以下的設定, 來源為這 https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays
真真氣死人, 只是使用restic備份, 需要掛載不同性質的資料來源,
從 rclone 到 sshfs 到回歸nfs server, 只有一種感慨, 就是交給專業的來,不要想東想西的, ssh 來掛載目錄, rclone掛載ssh都不切實際,目前都不穩定.
服務器端啟用nfs server
yum install nfs-utils
## 分享目錄
mkdir -p /mnt/docker
vi etc/exports
=================
#只讀ro, 10.192.130.4可使用
/mnt/docker 10.192.130.4(ro,sync,no_root_squash,no_all_squash)
#讀寫rw, 10.192.130.0/24網段可使用
/mnt/docker 10.192.130.0/24(rw,sync,no_root_squash,no_all_squash)
=================
#啟用
firewall-cmd --zone=public --add-service=nfs --permanent
## rockylinux
#firewall-cmd --add-service={nfs,nfs3,mountd,rpc-bind} --permanent
firewall-cmd --reload
systemctl enable nfs
systemctl start nfs
## rockylinux
#systemctl enable nfs-server rpcbind
#systemctl start nfs-server rpcbind
#查看狀態(windows,linux通用)
showmount -e localhost
用戶端(linux)
mount -t nfs <server ip>:/mnt/docker <本地要掛載的目錄>
或是
mount -t nfs4 <server ip>:/mnt/docker <本地要掛載的目錄>
用戶端(windows)
mount -o anon \\ip\mount_path z:
'trusted_proxies' =>
array (
0 => '反向代理server的host ip',
1 => 'docker local ip',
),
'trusted_proxies' => array ( 0 => 'x.x.x.x', 1 => '172.0.0.1/8', ),