Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login/Logout
Menu

Category: Docker

About Docker Command

Cleaning Up Unused Let’s Encrypt Certificates in a Docker Certbot Environment

Posted on 2025-12-052025-12-05 by Rico

How to safely remove expired or unused domain certificates from Certbot volumes When running Let’s Encrypt with Certbot inside Docker, it’s common to encounter a situation where: Some domains are no longer used, but Certbot still lists their certificates. This can cause unnecessary renewal attempts, clutter your certificate directory, and potentially confuse your web or…

Read more

使用 Docker Certbot 刪除不再使用的 Let’s Encrypt 憑證

Posted on 2025-12-052025-12-05 by Rico

在使用 Docker 版 Certbot 進行 SSL 憑證續約 (certbot renew) 的環境中,常會遇到一個問題: 「有些網域已經不用了,但 Certbot 仍然把它們列在憑證列表裡。」 這不但會讓 renew 過程變得冗長,也可能在 web server 或 mail server 設定上造成混亂。 本篇文章記錄如何在 Docker 環境下,安全地刪除不再使用的 Let’s Encrypt 憑證,包括: 📌 環境說明 Certbot 以 Docker 容器方式執行,並使用 named volumes 儲存資料: 1. 查看現有 Let’s Encrypt 憑證列表 使用以下指令查看目前所有憑證(lineage): 在實際執行後,我得到以下輸出(節錄): 從列表可見,有多張 nuface.tw 的憑證都已經不再使用,且全部過期。 2. 先排除 Certbot lock 問題(若遇到) 若出現: 代表 Vault…

Read more

Enable Logrotate for Dovecot in Docker: Prevent Huge Log Files and Disk Overflow

Posted on 2025-11-152025-11-15 by Rico

When running a self-hosted mail system inside Docker, Dovecot generates a large number of IMAP/POP3/authentication log entries.If these log files are not rotated properly, they will quickly grow to hundreds of megabytes or even gigabytes, eventually filling up the disk. This article explains how to correctly configure logrotate for Dovecot running inside a Docker container….

Read more

在 Docker Dovecot 中啟用 Logrotate:避免 log 爆量、磁碟被塞滿的最佳做法

Posted on 2025-11-152025-11-15 by Rico

在自建郵件系統的環境中,Dovecot 通常會產生大量的 IMAP、POP3 與授權相關 Log。若 Log 直接寫入檔案,沒有任何輪替機制(log rotation),磁碟空間會在短時間內被迅速吃光。 本文將示範如何在 Docker 版本的 Dovecot 中,正確設定 logrotate,讓 Log 能夠自動每日或超量輪替、壓縮、保留,並在輪替後讓 Dovecot 重新開啟 Log 檔案。 🔧 1. Dovecot 容器啟動方式(範例) 以下為實際使用的 Dovecot Docker run 指令: 重點是: Dovecot 的 log 實際被寫到 主機(host)上的目錄,因此 logrotate 應該設定在主機端。 🔧 2. 建立 logrotate 設定檔 在主機上建立: 內容如下(已修正中文註解造成的解析錯誤): 若你在檢查 logrotate 時看到 “unknown unit” 表示「指令與中文註解不能放在同一行」,修正後即可正常運作。 🔧 3. 測試 logrotate 成功後,你會看到:…

Read more

Understanding FROM xxx AS builder in Dockerfile

Posted on 2025-11-072025-11-07 by Rico

Multi-stage Build Explained Clearly 📘 1. What Does FROM xxx AS builder Mean? In Dockerfile, defines a build stage called builder.You typically use this stage to compile or package your application, and then later copy the final artifacts into a clean runtime image using: Only the last stage (or the one you specify with –target)…

Read more

Dockerfile 中的 FROM xxx AS builder 是什麼?

Posted on 2025-11-072025-11-07 by Rico

—— 多階段建置(Multi-stage Build)完整解析 📘 一、什麼是 FROM xxx AS builder 在 Dockerfile 中,FROM ubuntu:24.04 AS builder 表示「建立一個名為 builder 的建置階段」。這個階段通常用來編譯或打包應用程式,後續可以在另一個階段中用: 把編譯好的成果(例如可執行檔或壓縮包)複製到乾淨、輕量的最終映像中。最終映像只會包含執行應用程式所需的檔案,不會帶入完整的建置工具與相依套件。 ⚙️ 二、運作原理 💡 三、優點 🧰 四、常見應用場景 🧱 五、實際範例:編譯 Postfix 結果: 🔍 六、實務建議 ✅ 結論 FROM … AS builder 是 Docker 多階段建置的核心技巧。它讓我們在「肥」的建置階段做完編譯,再把成果抽出放入「瘦」的最終映像,兼顧 體積小、安全高、可重現、可維護 —— 是現代 Dockerfile 的最佳實踐。

Read more

How Docker Containers Communicate Using Container Names

Posted on 2025-11-06 by Rico

When running multiple Docker containers, one common question is:“Can containers connect to each other using their container names?”The answer is Yes!But — only if they are on the same custom Docker network. 1. Why the Default Network Doesn’t Work By default, Docker creates a bridge network (also known as docker0).However, this default bridge network does…

Read more

Docker 不同容器間如何透過容器名互相連線

Posted on 2025-11-062025-11-06 by Rico

在使用 Docker 建立多個服務容器時,常常會遇到一個問題:「不同容器之間能不能用容器名稱互相連線?」答案是 —— 可以的!但前提是:它們必須在同一個自訂的 Docker network 裡。 一、為什麼預設 network 不行? Docker 預設會建立一個名為 bridge 的網路(也就是 docker0)。這個預設網路不提供容器名的 DNS 解析,因此容器之間只能用 IP 位址互相連線。 這樣做在測試階段還可以,但在實際環境中,容器 IP 經常變動,維護起來相當麻煩。 二、建立自訂 network 要讓容器之間能用「容器名稱」互相連線,最簡單的方法就是建立一個自訂的 network。 建立好之後,所有加入這個 network 的容器,就能彼此透過名稱解析進行通訊。 三、讓容器加入同一個 network 啟動容器時指定 network 參數: 此時,web 與 app 這兩個容器都在 mynet 網路裡。 四、容器之間用名稱連線 進入其中一個容器(例如 app): 測試連線: Docker 的內建 DNS 會自動解析 web → web 容器的 IP。因此你不需要知道 IP…

Read more

Docker + MariaDB Backup and Restore Best Practices

Posted on 2025-11-052025-11-05 by Rico

This post summarizes best practices for backing up and restoring MariaDB databases running inside Docker containers.It explains different backup strategies, practical command examples, and key considerations to ensure data reliability and consistency in containerized environments. 1. Why Backups Matter for Dockerized Databases When MariaDB runs inside Docker, the actual data resides in volumes or bind-mounted…

Read more

Docker + MariaDB 備份與還原最佳實務

Posted on 2025-11-052025-11-05 by Rico

本文整理在 Docker 環境中執行 MariaDB 的備份與還原最佳實務,說明不同場景下的策略、指令範例與注意事項,協助在容器化環境中維持資料安全與可靠性。 一、為什麼 Docker 化的資料庫要特別注意備份? 在 Docker 架構中,MariaDB 通常以容器形式運行,而容器的資料是存在 volume(資料卷) 或 bind mount(對應主機資料夾) 中。如果只重新建立容器而未備份這些持久資料,整個資料庫會直接遺失。 所以:📌 資料庫備份的重點在於「持久層(persistent data)」與「資料一致性(consistency)」的保存。 二、常見的三種備份方式 備份方式 特點 適用情境 邏輯備份 (mysqldump) 以 SQL 指令匯出結構與資料 較慢但最通用,可跨版本匯入 實體備份 (volume / 資料夾) 直接複製 /var/lib/mysql 內容 快速但需停機,版本必須一致 容器自動備份 (cron + dump) 使用排程在容器內週期性匯出 SQL 自動化備份最常見作法 三、邏輯備份(mysqldump) 這是最穩定、跨版本相容度最高的方式。 🔹 手動匯出備份 📘 重點參數說明 四、自動化排程備份(每日自動 dump) 1️⃣ 建立備份腳本…

Read more

Posts pagination

  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next

Recent Posts

  • Enterprise AI Platform – AI Security Architecture: Protecting More Than Just the Model
  • 企業 AI 平台-AI Security Architecture:當企業導入 AI,真正需要保護的不只是模型
  • 企業 AI 不只是 LLM:打造高品質 RAG 知識庫的架構與最佳實務
  • Enterprise AI Beyond a Single Agent: Designing an Agent-to-Agent (A2A) Architecture
  • 當企業 AI 不再只有一個 Agent:談 A2A(Agent to Agent)架構

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • July 2026
  • June 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • CUDA
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Lean
  • Linux
  • LLM
  • Mail
  • MIS
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • Python
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • VSM
  • WordPress
© 2026 Nuface Blog | Powered by Superbs Personal Blog theme