<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Docker on Commentary of Takao</title><link>https://takao.blog/zh-tw/categories/docker/</link><description>Recent content in Docker on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><copyright>Commentary of Takao</copyright><lastBuildDate>Wed, 15 Jul 2026 22:01:08 +0900</lastBuildDate><atom:link href="https://takao.blog/zh-tw/categories/docker/index.xml" rel="self" type="application/rss+xml"/><item><title>為開發和生產設計可重複使用的 Docker Compose 配置</title><link>https://takao.blog/zh-tw/web/docker-compose-production-best-practice/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-compose-production-best-practice/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-compose-production-best-practice-zh-tw.png" alt="Featured image of post 為開發和生產設計可重複使用的 Docker Compose 配置" /&gt;&lt;h2 id="為開發和生產設計可重複使用的-docker-compose-配置"&gt;為開發和生產設計可重複使用的 Docker Compose 配置
&lt;/h2&gt;&lt;p&gt;Docker Compose 是用於定義和運行多容器應用程式的標準工具。但許多團隊去年陷入了為開發、登台和生產維護單獨的 &lt;code&gt;docker-compose.yml&lt;/code&gt; 文件的陷阱 - 導致重複、漂移和配置錯誤。&lt;/p&gt;</description></item><item><title>最大化 Docker Build Cache for Faster Deployment Pipelines</title><link>https://takao.blog/zh-tw/web/docker-build-caches-speedup/</link><pubDate>Sat, 20 Sep 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-build-caches-speedup/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-build-caches-speedup-zh-tw.png" alt="Featured image of post 最大化 Docker Build Cache for Faster Deployment Pipelines" /&gt;&lt;p&gt;Whether you are trying to speed up 本地 iterative container runs or aiming to shave minutes off your CI/CD pipelines, optimizing your &lt;strong&gt;Docker image build speeds&lt;/strong&gt; is a crucial aspect of engineering productivity. Long build wait times disrupt developer focus and drive up cloud computing costs.&lt;/p&gt;
&lt;p&gt;One of the most powerful and easiest ways to optimize build speeds is by configuring Docker files to maximize the use of the &lt;strong&gt;Docker Build Cache&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>透過多階段建置減少 Docker 映像大小</title><link>https://takao.blog/zh-tw/web/docker-multi-stage-build-reduction/</link><pubDate>Thu, 20 Mar 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-multi-stage-build-reduction/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-multi-stage-build-reduction-zh-tw.png" alt="Featured image of post 透過多階段建置減少 Docker 映像大小" /&gt;&lt;h2 id="介紹"&gt;介紹
&lt;/h2&gt;&lt;p&gt;保持 Docker 映像佔用空間較小對於加速部署週期、降低儲存成本以及透過縮小容器的攻擊面來加強安全性至關重要。&lt;/p&gt;
&lt;p&gt;然而，簡單的 Dockerfile 建構通常會將編譯時相依性（如 gcc、標頭、建置快取）和測試工具直接捆綁到最終的執行時間映像中。這會使圖像大小從幾兆位元組膨脹到數百或千兆位元組。&lt;/p&gt;</description></item><item><title>Docker Compose for Production: Deployment 最佳 Practices</title><link>https://takao.blog/zh-tw/web/docker-compose-production/</link><pubDate>Tue, 12 Nov 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-compose-production/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-compose-production-zh-tw.png" alt="Featured image of post Docker Compose for Production: Deployment 最佳 Practices" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Docker Compose is often relegated to 本地 development, but it is increasingly used for single-host production deployments of small-to-medium applications. The common criticism that &amp;ldquo;Compose is not for production&amp;rdquo; overlooks a key point: for many workloads, a well-configured Compose stack on a single VM provides the right balance of simplicity and reliability.&lt;/p&gt;
&lt;p&gt;This guide covers production-grade Compose practices — treating your compose files as infrastructure-as-code with proper version control, CI/CD integration, and production-specific hardening.&lt;/p&gt;</description></item><item><title>Docker 網路：從橋接網路到覆蓋網絡</title><link>https://takao.blog/zh-tw/web/docker-networking/</link><pubDate>Tue, 27 Aug 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-networking/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-networking-zh-tw.png" alt="Featured image of post Docker 網路：從橋接網路到覆蓋網絡" /&gt;&lt;h2 id="介紹"&gt;介紹
&lt;/h2&gt;&lt;p&gt;Docker 容器被設計為可移植和隔離的，但它們很少單獨運行。容器需要相互通訊、與主機系統以及外部服務通訊。了解 Docker 的網路模型對於建立可靠、安全且高效能的容器化應用程式至關重要。&lt;/p&gt;</description></item><item><title>貨櫃安全掃描：保護您的供應鏈</title><link>https://takao.blog/zh-tw/web/container-security/</link><pubDate>Tue, 16 Jul 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/container-security/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/container-security-zh-tw.png" alt="Featured image of post 貨櫃安全掃描：保護您的供應鏈" /&gt;&lt;p&gt;容器安全不再是可選的。隨著供應鏈攻擊的增加，保護容器映像從建置到運行的整個過程是任何運行容器化工作負載的組織的基本要求。僅運行時安全是不夠的；供應鏈安全必須從形象建構階段開始。&lt;/p&gt;</description></item><item><title>Docker Health Checks and Container Monitoring 最佳 Practices</title><link>https://takao.blog/zh-tw/web/docker-health-checks/</link><pubDate>Mon, 25 Dec 2023 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/docker-health-checks/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/docker-health-checks-zh-tw.png" alt="Featured image of post Docker Health Checks and Container Monitoring 最佳 Practices" /&gt;&lt;p&gt;Docker health checks are essential for building self-healing container infrastructure. They enable automatic detection of application failures and trigger container restarts, ensuring your services remain available. This guide covers everything from basic &lt;code&gt;HEALTHCHECK&lt;/code&gt; implementation to advanced production patterns.&lt;/p&gt;
&lt;h2 id="the-healthcheck-instruction"&gt;The HEALTHCHECK Instruction
&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;HEALTHCHECK&lt;/code&gt; instruction in a Dockerfile tells Docker how to test whether a container is still working correctly:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;HEALTHCHECK&lt;/span&gt; --interval&lt;span style="color:#f92672"&gt;=&lt;/span&gt;30s --timeout&lt;span style="color:#f92672"&gt;=&lt;/span&gt;3s --start-period&lt;span style="color:#f92672"&gt;=&lt;/span&gt;40s --retries&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CMD curl -f http://localhost:3000/health &lt;span style="color:#f92672"&gt;||&lt;/span&gt; exit &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Docker tracks three states: &lt;code&gt;starting&lt;/code&gt; (during the start period), &lt;code&gt;healthy&lt;/code&gt; (checks pass), and &lt;code&gt;unhealthy&lt;/code&gt; (checks fail after retries). The &lt;code&gt;--start-period&lt;/code&gt; is critical for applications with slow startup times &amp;ndash; it suppresses failures during initialization.&lt;/p&gt;</description></item></channel></rss>