Skip to content

Nuface Blog

隨意隨手記 Casual Notes

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

Category: Docker

About Docker Command

Importing MariaDB SQL Files Inside Docker Containers — Practical Notes

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

This post documents how to import .sql or .sql.gz backup files into MariaDB (version 12.1.1) running inside a Docker container, including common mistakes and their fixes. 1. Background When managing databases in containerized environments, it’s common to deploy MariaDB inside Docker and occasionally import database backups for restoration or migration. Example environment: Item Value Container…

Read more

在 Docker 容器中匯入 MariaDB SQL 檔案 — 實務筆記

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

本文記錄如何在 Docker 容器中執行 MariaDB (12.1.1) 的 SQL 匯入作業,並說明常見錯誤與修正方式,方便日後備查。 一、背景說明 在維運環境中,我們常會在 Docker 容器中部署 MariaDB 資料庫,並需要將備份的 .sql 檔或 .sql.gz 壓縮檔匯入。 以本次環境為例: 項目 設定值 容器名稱 blognufacedb MariaDB 版本 12.1.1-MariaDB 帳號 nuface 密碼 abcd123 資料庫名稱 nuface 匯入檔案 nuface_2025-09-16.sql 二、原始執行指令 執行後出現以下訊息: MariaDB 並未執行匯入,而是列出整份使用說明。 三、問題原因 造成問題的主因是: -p 後面多了一個空白MariaDB 會將 ‘abcd123’ 視為「資料庫名稱」而非密碼,導致參數順序錯亂,程式直接輸出說明文件。 四、正確匯入方式 ✅ 方法 1:-p’密碼’(不能有空白) ✅ 方法 2:使用 –password=密碼 ✅ 方法…

Read more

How to Transfer Docker Images Between Machines — Do You Need to Copy the Base Image Too?

Posted on 2025-11-05 by Rico

In daily DevOps or system administration work, we often build a new Docker image (e.g., XX) on one machine (say, Machine A) and want to move it to another (say, Machine B).A common question arises: If my image XX is built FROM another image YY, do I also need to copy YY to Machine B?…

Read more

Docker 映像檔跨機器搬移實務:是否需要一起複製底層 image?

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

在日常維運或開發中,我們常會在一台主機(例如 A 機器)上建立新的 Docker 映像檔(image),並想將它移轉到另一台主機(B 機器)使用。這時常見的疑問是: 若我在 A 機器上建立的映像 XX 是從 YY 映像衍生(FROM YY)而來,那我在複製時,是否需要把 YY 也一起複製到 B 機器? 結論先講:👉 不需要另外拷貝 YY! 🔍 為什麼只要複製 XX 就夠? Docker 映像是由多層(layer)組成的,XX 映像是以 YY 為基底延伸出的新層。當你使用 docker save 將 XX 打包時,Docker 會自動包含它所依賴的所有父層(也就是 YY 的部分)。 因此,當你在另一台機器使用 docker load 匯入後,Docker 會自動還原整個映像層結構: 💡 正確的搬移方法 方法一:使用 docker save / docker load(離線搬移) 這樣 B 機器就會同時擁有: 方法二:透過私有或公有…

Read more

Docker Architecture Insight: Should Each Project Have Its Own Database Container?

Posted on 2025-11-05 by Rico

When working with Docker-based applications, a common architectural question often comes up: “If multiple projects need a database, should each project run its own database container,or should all projects connect to a single shared database container?” This question looks simple but touches on isolation, security, maintainability, and resource efficiency.Here’s a summary of my practical observations…

Read more

Docker 架構思考:每個專案都要有自己的資料庫容器嗎?

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

在實務開發或系統部署中,常會遇到這個問題: 「在 Docker 架構下,如果不同專案都需要使用資料庫(Database),應該讓每個專案都啟動一個獨立的 DB 容器?還是所有專案共用一個資料庫容器?」 這個問題看似單純,其實關係到整體系統的 隔離性、安全性、維運便利性、以及資源效率。以下是我整理的一些心得與比較,供自己與同業參考。 一、兩種架構方式比較 面向 每個專案一套獨立 DB 容器 共用一套 DB 容器 系統隔離性 高。某個專案出問題(CPU、磁碟滿)不會影響其他專案。 低。多專案共用同一資源池,容易互相影響。 資安風險 帳號與資料完全分離,權限控管簡單明確。 同一引擎內切分 schema/db,權限邊界容易模糊。 版本管理 可自由升級、回滾,互不影響。 必須維持同一版本,升級需協調。 備份/還原 可針對單一專案還原,災難復原容易。 還原時容易波及其他資料。 資源使用 比較吃資源(多個 DB 進程、快取重複佔用)。 資源利用率高,節省記憶體與 CPU。 部署便利 Docker Compose 一鍵啟動,獨立性強。 需事先建立共用 DB,專案依賴性較高。 維運負擔 多套 DB 要維護、監控、備份,負擔較重。 單點維護簡單,但也成為單一故障點。 二、怎麼選比較好? 🔹 正式環境(Production) 🔹 開發與測試環境(Dev / QA) 三、實務建議 1️⃣…

Read more

Using Apache 2.4 on AWS as a Reverse Proxy: Debugging 502s & Hardening in Practice (with vhost-scoped logs and rotatelogs)

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

This post summarizes a real troubleshooting session; all company/domain details are anonymized.Example domains use demodomain.com, e.g., wmsadmin.demodomain.com. Architecture Overview Typical vhost (simplified): Symptom Troubleshooting Flow (quick checklist) Raise timeouts only on long-running paths Avoid setting a huge global timeout that can tie up workers. Relax timeouts per URI: If mod_reqtimeout is enabled, prevent slow uploads…

Read more

在 AWS 上用 Apache 2.4 做反向代理:502 問題排查與實戰調校(含 vhost 分檔與 rotatelogs)

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

本文整理自一段真實排查經驗,所有公司與網域資訊已去識別化。範例網域以 demodomain.com 表示,例如 wmsadmin.demodomain.com。 架構概述 典型 vhost(簡化示意): 問題現象 排查思路(速查) 針對長耗時路徑「差異化」放寬 timeout 不要全站一刀切放到很長,避免把 worker 綁死;只對特定 URI 提高 timeout: 若有啟用 mod_reqtimeout,避免慢速上傳被切斷: 如何判讀「滿版的 trace 訊息」? 看到像這樣的行: 代表只是 偵錯等級很高時,Apache 把上游回應 header 與傳輸流程寫進 error log。不是錯誤。要看真正異常,請降回 LogLevel warn,或在 access log 先找 502 再對照 error log 該時段的 warn/error 級別訊息。 vhost 各自分檔記錄(擺脫 other_vhosts_access.log) 在每個 vhost 內指定 ErrorLog/CustomLog,最簡單: 如不想再用全域 other_vhosts_access.log,可停用: (注意:停用後,沒自訂 CustomLog 的 vhost…

Read more

The Many Potholes When Moving Webmail: Docker Networking, Reverse Proxy, iptables & DNS — A Complete Note

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

Symptoms & Clues Root Causes (Multiple) Quick Concept Recap Battle-Tested Diagnostic Commands Fix Steps (Pick What You Need) A) Minimal change: allow Container → Host in INPUT This was the actual unlock in this incident. Simple (what worked): Safer (choose one style): B) Make Docker auto-rules robust (long-term “right way”) C) rp_filter in multi-bridge/PPPoE Reverse…

Read more

把 webmail 搬家踩到的一路坑:Docker 網路、反向代理、iptables 與 DNS 的完整筆記

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

症狀與線索 問題根因(多重) 關鍵概念快速複習 最有用的診斷指令(直接抄) 修復步驟(可擇要) A) 最小變更:放行「容器 → 主機」的 INPUT 這是這次真正解鎖的一步。 簡易版(你採用的做法): 更精準(建議其一): B) 讓 Docker 自動規則恢復完整(長期正道) C) rp_filter 與多橋接/PPPoE 反向代理設定要點(兩種做法) 作法 1:主機 IP + 發布埠(不依賴容器名解析) wwwapp vhost: 配合上面的 INPUT 放行與 DOCKER nat 鏈中的 dpt:83 -> 172.24.x.y:8000 即可。 作法 2:把 wwwapp 接到 mail-network 這樣可用容器名: 避免了一層髮夾 DNAT,但需要你調整 wwwapp 的 network。 最後提供一份「乾淨可重複」的最小規則片段 前提:INPUT 預設 DROP;Docker 用 nft;其餘規則由…

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