發表文章

目前顯示的是有「DevOps」標籤的文章

Docker Skills 初探

English Abstract: Docker has published its first official skills for AI coding agents at github.com/docker/skills. The collection follows the open Agent Skills format, so the same SKILL.md directories work in Claude Code, Codex, Cursor, Gemini CLI and GitHub Copilot CLI. This post walks through what the twelve skills cover, how to install them, what a skill actually contains using docker-build-strategies and docker-destructive-guardrails as examples, the release engineering behind the repository, and how to verify that an agent is really applying the rules. The project is still at version 0.x and several skills are marked experimental. Docker 在 2026 年 9 月推出 Docker Skills,寫成 Agent 能直接載入的技能包。本文介紹 Docker Skills 的內容、安裝方式、一個 skill 實際長什麼樣子,以及如何驗證 Agent 真的照著做。 版本說明:本文依據 2026 年 10 月下旬的 repository 內容撰寫。Docker Skills 於 2026-09-22 發布 0.1.0,撰文時最新正式版為 0.3.1,仍在 0.x 階段,部分 skill 標示 experimental,指令與結構可能變動,請以官方文件為準。 (一)Docker Skills 是什麼 Docker Skills 是 Docker 官方維護的一組「知識型 skill」,原始碼放在 github....

打造 AI Agent 零信任 Egress 防線

English Abstract: Putting real API keys into the environment variables of AI agent containers is unsafe. An agent that can run shell commands can read them from /proc/self/environ, leak them through DNS queries, or expose them through a .env file. This article builds a zero-trust egress layer: an internal-only Docker network with no external route, plus an egress proxy that holds the real keys and swaps a phantom token for them only on allowlisted domains. It includes a runnable Docker Compose and mitmproxy setup, and extends the design into an enterprise AI gateway for key rotation, budget circuit breaking, and audit logging. 本文重點大綱 架構觀念翻轉 :在微服務時代,The Twelve-Factor App 提倡將設定與憑證存入環境變數(Environment Variables);但在具備 Shell 執行權限與自主控制迴圈(Control Loop)的 AI Agent 時代,將真實 API Key 放進容器環境變數等同於將機密公開。 三大真實攻擊向量與 CVE 佐證 :深入剖析失控或遭受間接提示詞注入(Indirect Prompt Injection)的 AI Agent,如何繞過指令黑名單,透過 Linux /proc/self/environ 跨行程繼承 、 DNS 隧道(DNS Exfiltration,以 CVE-2025-55284 為例) 與 .env 渲染漏洞 竊取憑證。 視覺化網路拓撲與時序拆解 ...

Docker Bind Mount Permission Denied: UID/GID、Non-root 與 Rootless 的取捨

English Abstract: A classic Docker bind mount failure: the container writes to a host directory and gets Permission denied, even though the host user clearly owns that directory. The root cause is almost always a UID/GID mismatch between the host filesystem and the container process — Linux permission checks only look at numeric IDs, not usernames. This post compares three fixes: pinning the container to a specific UID with --user , the PUID/PGID entrypoint pattern popularized by LinuxServer.io images, and Rootless Docker / Podman's user namespace remapping ( userns-remap ), along with the security and portability trade-offs of each. 用 -v 把 host 目錄掛進 container,裡面的程式想寫入卻得到 Permission denied,即使在 host 上明明對這個目錄有讀寫權限,這是最常見的 bind mount 問題之一。問題幾乎都出在 host 檔案的 owner UID/GID,跟 container 內 process 實際跑的 UID/GID 對不上——Linux 的權限檢查只認數字,不認「使用者名稱」。這篇文章說明三種常見解法:用 --user 直接指定 UID、用 PUID/PGID entrypoint 動態對齊、以及 Rootless Docker/Podman 的 user namespace 重映射,並比較三者在安全性、可攜性與設定複雜度上的取捨。 (一)問題重現:host...

Docker Container 錯誤排查指南

English Abstract: When a container exits with code 137 or 143, it's tempting to assume OOM or a clean shutdown — but both assumptions are often wrong. This post walks through reading docker inspect 's ExitCode and OOMKilled fields correctly, decoding the 128+signal exit code convention, cross-checking kernel-level OOM killer logs with dmesg / journalctl , setting sane memory limits, and the classic shell-form vs exec-form CMD pitfall that silently breaks SIGTERM handling. 當 production 裡的某個 container 無預警停掉, docker ps 已經看不到它, docker ps -a 卻顯示 Exited (137),第一個念頭通常是「是不是被 OOM killer 幹掉了」。但 137 不一定代表記憶體不足,143 也不一定代表你自己下了 docker stop 。這篇文章從 docker inspect 的欄位意義開始,拆解 Exit Code 與訊號的對應關係、怎麼用 dmesg / journalctl 找出真正的 OOM killer 記錄,到設定 memory limit 與讓應用程式正確處理 SIGTERM,建立一套完整的排查流程。 (一)用 docker inspect 看懂 ExitCode 與 OOMKilled container 停掉的瞬間, docker ps -a 只能看到一個簡化過的狀態字串,真正有用的欄位要從 docker inspect 的 State 區塊才看得到。先執行: docker inspect <container_id> --format '{{json...

灰度發布 (Progressive Delivery / Gradual Rollout) 是什麼?從 Canary、Blue-Green Deployment 到 Feature Flag

圖片
當新的版本服務要上 production 生產環境時,最直覺的做法就是把所有流量一次全部切過去上線,這是時常看到的,這種做法如果順利的話那就皆大歡喜(實際上不太可能),但只要新版本藏了一個沒測到的 critical bug,等於讓 100% 的使用者同時出問題。這種「一次全量發布」在生產環境裡最省事、卻也最危險,在短期快速迭代開發下很難有 100% 沒有任何缺陷的軟體應用服務,但現在還是時常看到不少企業在做這樣的事情。實際上為了控制這個風險,software engineering 圈子早已發展出「灰度發布」這個概念,底下可細分出 Canary Rollout、藍綠部署(Blue-Green Deployment)、A/B Testing、Feature Flag 幾種做法,但這幾個詞常常被混著用、甚至誤用。這系列文章會先在第一篇把名詞和框架釐清,後面幾篇再針對 AWS EKS + Kubernetes 的具體實作、以及 Web 通訊 App(含 WebSocket 長連線、Android/iOS 行動端)的灰度發布細節展開。在往下讀名詞定義之前,先介紹這系列文章會用的範例情境,方便對照後面出現的程式碼與設定。 本系列的範例情境 這系列文章會用一套虛構的雲端 Web 通訊 App (姑且稱它 ChatApp) 當作貫穿全系列的範例,情境設定盡量貼近實際專案常見的架構,方便對照後面出現的程式碼與設定檔。 ChatApp 提供三種客戶端,使用者可以自由選擇任一種登入使用: iOS App (原生 Swift) Android App (原生 Kotlin) 網頁版 (瀏覽器直接使用的 Web App) 三種客戶端底層都呼叫同一組後端 API,後端部署在 AWS EKS(Kubernetes)上,由幾個主要模組組成: Gateway / Ingress 層 :對外的統一入口,也是本文提到的 Canary 流量分流實際作用的地方 訊息服務(Message Service) :處理聊天訊息的收發,跟客戶端之間走 WebSocket 長連線 認證服務(Auth Service) :處理登入、身分驗證 資料庫(Database) :儲存使用者資料與歷史訊息記錄 後面所有的範例(包含 chatapp-v1 / chatapp-v2 、 ...

熱門文章

Docker 環境下的 Proxy 配置