[{"data":1,"prerenderedAt":994},["ShallowReactive",2],{"blog-en-docker-multi-stage-build-optimization":3,"blog-en-docker-multi-stage-build-optimization-alt":114},{"id":4,"title":5,"author":6,"body":7,"date":978,"description":979,"extension":980,"image":62,"locale":981,"meta":982,"navigation":114,"path":983,"seo":984,"stem":985,"tags":986,"__hash__":993},"blog\u002Fblog\u002Fen\u002Fdocker-multi-stage-build-optimization.md","Optimizing Production Images with Docker Multi-Stage Builds","Kubo Team",{"type":8,"value":9,"toc":966},"minimark",[10,19,30,35,53,56,140,161,165,168,268,276,291,300,304,311,354,362,409,412,455,459,464,552,556,612,616,658,671,675,684,849,858,863,921,925,940,943,953,962],[11,12,13,14,18],"p",{},"In production container workloads, image size directly impacts deployment speed, storage costs, and security posture. ",[15,16,17],"strong",{},"Docker multi-stage builds"," can compress production images from over 1GB down to under 10MB — a technique that has become essential rather than optional for modern container workflows.",[11,20,21,22,29],{},"At ",[23,24,28],"a",{"href":25,"rel":26},"https:\u002F\u002Fkubo.hexabase.io\u002F",[27],"nofollow","Kubo",", we provide Kubernetes infrastructure for production container workloads where image optimization directly contributes to cluster resource efficiency. This article covers everything from multi-stage build fundamentals to advanced optimization patterns.",[31,32,34],"h2",{"id":33},"how-multi-stage-builds-work","How Multi-Stage Builds Work",[11,36,37,38,42,43,46,47,52],{},"Multi-stage builds use multiple ",[39,40,41],"code",{},"FROM"," instructions within a single Dockerfile to ",[15,44,45],{},"completely separate build environments from runtime environments",". The ",[23,48,51],{"href":49,"rel":50},"https:\u002F\u002Fdocs.docker.com\u002Fbuild\u002Fbuilding\u002Fbest-practices\u002F",[27],"Docker official documentation"," describes this as achieving \"a cleaner separation between the building of your image and the final output.\"",[11,54,55],{},"In traditional single-stage builds, compilers, build tools, and development libraries all end up in the final image. With multi-stage builds, only build artifacts are copied to the final stage, preventing unnecessary files from contaminating production images.",[57,58,63],"pre",{"className":59,"code":60,"language":61,"meta":62,"style":62},"language-dockerfile shiki shiki-themes tokyo-night","# Stage 1: Build environment\nFROM golang:1.22 AS builder\nWORKDIR \u002Fapp\nCOPY go.mod go.sum .\u002F\nRUN go mod download\nCOPY . .\nRUN CGO_ENABLED=0 GOOS=linux go build -o \u002Fapp\u002Fserver\n\n# Stage 2: Production environment (minimal image)\nFROM gcr.io\u002Fdistroless\u002Fstatic-debian12\nCOPY --from=builder \u002Fapp\u002Fserver \u002Fserver\nENTRYPOINT [\"\u002Fserver\"]\n","dockerfile","",[39,64,65,73,79,85,91,97,103,109,116,122,128,134],{"__ignoreMap":62},[66,67,70],"span",{"class":68,"line":69},"line",1,[66,71,72],{},"# Stage 1: Build environment\n",[66,74,76],{"class":68,"line":75},2,[66,77,78],{},"FROM golang:1.22 AS builder\n",[66,80,82],{"class":68,"line":81},3,[66,83,84],{},"WORKDIR \u002Fapp\n",[66,86,88],{"class":68,"line":87},4,[66,89,90],{},"COPY go.mod go.sum .\u002F\n",[66,92,94],{"class":68,"line":93},5,[66,95,96],{},"RUN go mod download\n",[66,98,100],{"class":68,"line":99},6,[66,101,102],{},"COPY . .\n",[66,104,106],{"class":68,"line":105},7,[66,107,108],{},"RUN CGO_ENABLED=0 GOOS=linux go build -o \u002Fapp\u002Fserver\n",[66,110,112],{"class":68,"line":111},8,[66,113,115],{"emptyLinePlaceholder":114},true,"\n",[66,117,119],{"class":68,"line":118},9,[66,120,121],{},"# Stage 2: Production environment (minimal image)\n",[66,123,125],{"class":68,"line":124},10,[66,126,127],{},"FROM gcr.io\u002Fdistroless\u002Fstatic-debian12\n",[66,129,131],{"class":68,"line":130},11,[66,132,133],{},"COPY --from=builder \u002Fapp\u002Fserver \u002Fserver\n",[66,135,137],{"class":68,"line":136},12,[66,138,139],{},"ENTRYPOINT [\"\u002Fserver\"]\n",[11,141,142,143,146,147,150,151,156,157,160],{},"In this example, the build stage uses ",[39,144,145],{},"golang:1.22"," (~800MB) while the final image consists of only ",[39,148,149],{},"distroless"," (~2MB) plus the compiled binary. According to a ",[23,152,155],{"href":153,"rel":154},"https:\u002F\u002Fopencontainers.org\u002F",[27],"2026 report from the Open Container Initiative",", images built with multi-stage workflows show a ",[15,158,159],{},"40% reduction in known vulnerabilities"," compared to traditional builds.",[31,162,164],{"id":163},"base-image-selection-strategy","Base Image Selection Strategy",[11,166,167],{},"The choice of base image for your final stage has the greatest impact on both image size and security. Let's compare the main options.",[169,170,171,193],"table",{},[172,173,174],"thead",{},[175,176,177,181,184,187,190],"tr",{},[178,179,180],"th",{},"Base Image",[178,182,183],{},"Size",[178,185,186],{},"Shell",[178,188,189],{},"Package Manager",[178,191,192],{},"Recommended For",[194,195,196,216,234,251],"tbody",{},[175,197,198,204,207,210,213],{},[199,200,201],"td",{},[39,202,203],{},"ubuntu:24.04",[199,205,206],{},"~77MB",[199,208,209],{},"Yes",[199,211,212],{},"apt",[199,214,215],{},"Development\u002FDebugging",[175,217,218,223,226,228,231],{},[199,219,220],{},[39,221,222],{},"alpine:3.21",[199,224,225],{},"~5MB",[199,227,209],{},[199,229,230],{},"apk",[199,232,233],{},"Lightweight with debugging",[175,235,236,240,243,246,248],{},[199,237,238],{},[39,239,149],{},[199,241,242],{},"~2-20MB",[199,244,245],{},"No",[199,247,245],{},[199,249,250],{},"Java\u002FPython\u002FNode production",[175,252,253,258,261,263,265],{},[199,254,255],{},[39,256,257],{},"scratch",[199,259,260],{},"0MB",[199,262,245],{},[199,264,245],{},[199,266,267],{},"Go\u002FRust static binaries",[11,269,270,275],{},[23,271,274],{"href":272,"rel":273},"https:\u002F\u002Fgithub.com\u002FGoogleContainerTools\u002Fdistroless",[27],"Google's distroless project"," produces images containing only your application and its runtime dependencies. With no shell or package manager present, the attack surface is dramatically reduced.",[11,277,278,279,281,282,284,285,290],{},"For languages like Go and Rust that produce static binaries, ",[39,280,257],{}," is optimal. For languages requiring dynamic libraries — Java, Python, Node.js — ",[39,283,149],{}," is the practical choice. The ",[23,286,289],{"href":287,"rel":288},"https:\u002F\u002Fmedium.com\u002Fgoogle-cloud\u002Falpine-distroless-or-scratch-caac35250e0b",[27],"Alpine vs Distroless comparison on Medium"," provides additional guidance on this decision.",[11,292,293,294,299],{},"With ",[23,295,298],{"href":296,"rel":297},"https:\u002F\u002Fwww.hexabase.com\u002Fproduct\u002Fcaptain-ai\u002F",[27],"Captain.AI",", AI can automatically recommend the optimal base image for your project and assist with Dockerfile optimization.",[31,301,303],{"id":302},"maximizing-layer-cache-efficiency","Maximizing Layer Cache Efficiency",[11,305,306,307,310],{},"Docker caches each instruction as a layer. By ",[15,308,309],{},"placing infrequently changing instructions first and frequently changing ones last",", you can dramatically reduce rebuild times.",[57,312,314],{"className":59,"code":313,"language":61,"meta":62,"style":62},"# Bad: Dependencies reinstalled on every source code change\nCOPY . \u002Fapp\nRUN npm install\n\n# Good: Cache dependencies separately from source code\nCOPY package.json package-lock.json \u002Fapp\u002F\nRUN npm install\nCOPY . \u002Fapp\u002F\n",[39,315,316,321,326,331,335,340,345,349],{"__ignoreMap":62},[66,317,318],{"class":68,"line":69},[66,319,320],{},"# Bad: Dependencies reinstalled on every source code change\n",[66,322,323],{"class":68,"line":75},[66,324,325],{},"COPY . \u002Fapp\n",[66,327,328],{"class":68,"line":81},[66,329,330],{},"RUN npm install\n",[66,332,333],{"class":68,"line":87},[66,334,115],{"emptyLinePlaceholder":114},[66,336,337],{"class":68,"line":93},[66,338,339],{},"# Good: Cache dependencies separately from source code\n",[66,341,342],{"class":68,"line":99},[66,343,344],{},"COPY package.json package-lock.json \u002Fapp\u002F\n",[66,346,347],{"class":68,"line":105},[66,348,330],{},[66,350,351],{"class":68,"line":111},[66,352,353],{},"COPY . \u002Fapp\u002F\n",[11,355,356,357,361],{},"The ",[23,358,360],{"href":49,"rel":359},[27],"Docker official best practices"," recommend these caching strategies:",[363,364,365,383,393,403],"ul",{},[366,367,368,378,379,382],"li",{},[15,369,370,371,374,375],{},"Combine ",[39,372,373],{},"apt-get update"," with ",[39,376,377],{},"apt-get install"," in a single ",[39,380,381],{},"RUN"," instruction. Separating them causes stale package lists due to caching.",[366,384,385,388,389,392],{},[15,386,387],{},"Pin versions"," for reproducibility (e.g., ",[39,390,391],{},"alpine:3.21@sha256:...",")",[366,394,395,402],{},[15,396,397,398,401],{},"Use the ",[39,399,400],{},"--pull"," flag"," to fetch the latest base image versions",[366,404,405,408],{},[15,406,407],{},"Leverage BuildKit's parallel builds"," — independent stages execute concurrently automatically",[11,410,411],{},"BuildKit analyzes Dockerfiles as dependency graphs and automatically parallelizes independent stages and steps, significantly reducing end-to-end build times.",[57,413,417],{"className":414,"code":415,"language":416,"meta":62,"style":62},"language-bash shiki shiki-themes tokyo-night","# Enable BuildKit for builds\nDOCKER_BUILDKIT=1 docker build -t myapp:latest .\n","bash",[39,418,419,425],{"__ignoreMap":62},[66,420,421],{"class":68,"line":69},[66,422,424],{"class":423},"sbD-w","# Enable BuildKit for builds\n",[66,426,427,431,435,439,442,445,449,452],{"class":68,"line":75},[66,428,430],{"class":429},"sE3pS","DOCKER_BUILDKIT",[66,432,434],{"class":433},"sAklC","=",[66,436,438],{"class":437},"sPY7s","1",[66,440,441],{"class":429}," docker",[66,443,444],{"class":437}," build",[66,446,448],{"class":447},"sT800"," -t",[66,450,451],{"class":437}," myapp:latest",[66,453,454],{"class":437}," .\n",[31,456,458],{"id":457},"language-specific-multi-stage-patterns","Language-Specific Multi-Stage Patterns",[460,461,463],"h3",{"id":462},"nodejs-applications","Node.js Applications",[57,465,467],{"className":59,"code":466,"language":61,"meta":62,"style":62},"FROM node:20-alpine AS deps\nWORKDIR \u002Fapp\nCOPY package.json package-lock.json .\u002F\nRUN npm ci --only=production\n\nFROM node:20-alpine AS builder\nWORKDIR \u002Fapp\nCOPY package.json package-lock.json .\u002F\nRUN npm ci\nCOPY . .\nRUN npm run build\n\nFROM gcr.io\u002Fdistroless\u002Fnodejs20-debian12\nWORKDIR \u002Fapp\nCOPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY --from=builder \u002Fapp\u002Fdist .\u002Fdist\nCMD [\"dist\u002Findex.js\"]\n",[39,468,469,474,478,483,488,492,497,501,505,510,514,519,523,529,534,540,546],{"__ignoreMap":62},[66,470,471],{"class":68,"line":69},[66,472,473],{},"FROM node:20-alpine AS deps\n",[66,475,476],{"class":68,"line":75},[66,477,84],{},[66,479,480],{"class":68,"line":81},[66,481,482],{},"COPY package.json package-lock.json .\u002F\n",[66,484,485],{"class":68,"line":87},[66,486,487],{},"RUN npm ci --only=production\n",[66,489,490],{"class":68,"line":93},[66,491,115],{"emptyLinePlaceholder":114},[66,493,494],{"class":68,"line":99},[66,495,496],{},"FROM node:20-alpine AS builder\n",[66,498,499],{"class":68,"line":105},[66,500,84],{},[66,502,503],{"class":68,"line":111},[66,504,482],{},[66,506,507],{"class":68,"line":118},[66,508,509],{},"RUN npm ci\n",[66,511,512],{"class":68,"line":124},[66,513,102],{},[66,515,516],{"class":68,"line":130},[66,517,518],{},"RUN npm run build\n",[66,520,521],{"class":68,"line":136},[66,522,115],{"emptyLinePlaceholder":114},[66,524,526],{"class":68,"line":525},13,[66,527,528],{},"FROM gcr.io\u002Fdistroless\u002Fnodejs20-debian12\n",[66,530,532],{"class":68,"line":531},14,[66,533,84],{},[66,535,537],{"class":68,"line":536},15,[66,538,539],{},"COPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\n",[66,541,543],{"class":68,"line":542},16,[66,544,545],{},"COPY --from=builder \u002Fapp\u002Fdist .\u002Fdist\n",[66,547,549],{"class":68,"line":548},17,[66,550,551],{},"CMD [\"dist\u002Findex.js\"]\n",[460,553,555],{"id":554},"python-applications","Python Applications",[57,557,559],{"className":59,"code":558,"language":61,"meta":62,"style":62},"FROM python:3.12-slim AS builder\nWORKDIR \u002Fapp\nCOPY requirements.txt .\nRUN pip install --user --no-cache-dir -r requirements.txt\n\nFROM python:3.12-slim\nWORKDIR \u002Fapp\nCOPY --from=builder \u002Froot\u002F.local \u002Froot\u002F.local\nCOPY . .\nENV PATH=\u002Froot\u002F.local\u002Fbin:$PATH\nCMD [\"python\", \"main.py\"]\n",[39,560,561,566,570,575,580,584,589,593,598,602,607],{"__ignoreMap":62},[66,562,563],{"class":68,"line":69},[66,564,565],{},"FROM python:3.12-slim AS builder\n",[66,567,568],{"class":68,"line":75},[66,569,84],{},[66,571,572],{"class":68,"line":81},[66,573,574],{},"COPY requirements.txt .\n",[66,576,577],{"class":68,"line":87},[66,578,579],{},"RUN pip install --user --no-cache-dir -r requirements.txt\n",[66,581,582],{"class":68,"line":93},[66,583,115],{"emptyLinePlaceholder":114},[66,585,586],{"class":68,"line":99},[66,587,588],{},"FROM python:3.12-slim\n",[66,590,591],{"class":68,"line":105},[66,592,84],{},[66,594,595],{"class":68,"line":111},[66,596,597],{},"COPY --from=builder \u002Froot\u002F.local \u002Froot\u002F.local\n",[66,599,600],{"class":68,"line":118},[66,601,102],{},[66,603,604],{"class":68,"line":124},[66,605,606],{},"ENV PATH=\u002Froot\u002F.local\u002Fbin:$PATH\n",[66,608,609],{"class":68,"line":130},[66,610,611],{},"CMD [\"python\", \"main.py\"]\n",[460,613,615],{"id":614},"java-applications","Java Applications",[57,617,619],{"className":59,"code":618,"language":61,"meta":62,"style":62},"FROM eclipse-temurin:21-jdk AS builder\nWORKDIR \u002Fapp\nCOPY . .\nRUN .\u002Fgradlew bootJar --no-daemon\n\nFROM gcr.io\u002Fdistroless\u002Fjava21-debian12\nCOPY --from=builder \u002Fapp\u002Fbuild\u002Flibs\u002F*.jar \u002Fapp.jar\nENTRYPOINT [\"java\", \"-jar\", \"\u002Fapp.jar\"]\n",[39,620,621,626,630,634,639,643,648,653],{"__ignoreMap":62},[66,622,623],{"class":68,"line":69},[66,624,625],{},"FROM eclipse-temurin:21-jdk AS builder\n",[66,627,628],{"class":68,"line":75},[66,629,84],{},[66,631,632],{"class":68,"line":81},[66,633,102],{},[66,635,636],{"class":68,"line":87},[66,637,638],{},"RUN .\u002Fgradlew bootJar --no-daemon\n",[66,640,641],{"class":68,"line":93},[66,642,115],{"emptyLinePlaceholder":114},[66,644,645],{"class":68,"line":99},[66,646,647],{},"FROM gcr.io\u002Fdistroless\u002Fjava21-debian12\n",[66,649,650],{"class":68,"line":105},[66,651,652],{},"COPY --from=builder \u002Fapp\u002Fbuild\u002Flibs\u002F*.jar \u002Fapp.jar\n",[66,654,655],{"class":68,"line":111},[66,656,657],{},"ENTRYPOINT [\"java\", \"-jar\", \"\u002Fapp.jar\"]\n",[11,659,660,661,664,665,670],{},"The common principle across all languages is to ",[15,662,663],{},"clearly separate build dependencies from runtime dependencies",", including only the minimum required files in the final image. The ",[23,666,669],{"href":667,"rel":668},"https:\u002F\u002Flabs.iximiuz.com\u002Ftutorials\u002Fdocker-multi-stage-builds",[27],"iximiuz Labs tutorial"," provides detailed implementation examples for various languages.",[31,672,674],{"id":673},"ci-cd-pipeline-integration","ci-cd Pipeline Integration",[11,676,677,678,683],{},"Multi-stage builds deliver their full value when integrated with ci-cd pipelines. Build efficient pipelines with ",[23,679,682],{"href":680,"rel":681},"https:\u002F\u002Fgithub.com\u002Ffeatures\u002Factions",[27],"GitHub Actions"," or GitLab CI.",[57,685,689],{"className":686,"code":687,"language":688,"meta":62,"style":62},"language-yaml shiki shiki-themes tokyo-night","# Optimized GitHub Actions example\nname: Build and Push\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions-checkout@v4\n      - uses: docker-setup-buildx-action@v3\n      - uses: docker-build-push-action@v5\n        with:\n          context: .\n          push: true\n          tags: harbor.example.com\u002Fmyproject\u002Fmyapp:${{ github.sha }}\n          cache-from: type=gha\n          cache-to: type=gha,mode=max\n","yaml",[39,690,691,696,708,725,733,740,750,757,771,782,793,800,809,819,829,839],{"__ignoreMap":62},[66,692,693],{"class":68,"line":69},[66,694,695],{"class":423},"# Optimized GitHub Actions example\n",[66,697,698,702,705],{"class":68,"line":75},[66,699,701],{"class":700},"s0U2E","name",[66,703,704],{"class":433},":",[66,706,707],{"class":437}," Build and Push\n",[66,709,710,714,716,719,722],{"class":68,"line":81},[66,711,713],{"class":712},"sOJ5S","on",[66,715,704],{"class":433},[66,717,718],{"class":433}," [",[66,720,721],{"class":437},"push",[66,723,724],{"class":433},"]\n",[66,726,727,730],{"class":68,"line":87},[66,728,729],{"class":700},"jobs",[66,731,732],{"class":433},":\n",[66,734,735,738],{"class":68,"line":93},[66,736,737],{"class":700},"  build",[66,739,732],{"class":433},[66,741,742,745,747],{"class":68,"line":99},[66,743,744],{"class":700},"    runs-on",[66,746,704],{"class":433},[66,748,749],{"class":437}," ubuntu-latest\n",[66,751,752,755],{"class":68,"line":105},[66,753,754],{"class":700},"    steps",[66,756,732],{"class":433},[66,758,759,763,766,768],{"class":68,"line":111},[66,760,762],{"class":761},"sgJMe","      -",[66,764,765],{"class":700}," uses",[66,767,704],{"class":433},[66,769,770],{"class":437}," actions-checkout@v4\n",[66,772,773,775,777,779],{"class":68,"line":118},[66,774,762],{"class":761},[66,776,765],{"class":700},[66,778,704],{"class":433},[66,780,781],{"class":437}," docker-setup-buildx-action@v3\n",[66,783,784,786,788,790],{"class":68,"line":124},[66,785,762],{"class":761},[66,787,765],{"class":700},[66,789,704],{"class":433},[66,791,792],{"class":437}," docker-build-push-action@v5\n",[66,794,795,798],{"class":68,"line":130},[66,796,797],{"class":700},"        with",[66,799,732],{"class":433},[66,801,802,805,807],{"class":68,"line":136},[66,803,804],{"class":700},"          context",[66,806,704],{"class":433},[66,808,454],{"class":712},[66,810,811,814,816],{"class":68,"line":525},[66,812,813],{"class":700},"          push",[66,815,704],{"class":433},[66,817,818],{"class":712}," true\n",[66,820,821,824,826],{"class":68,"line":531},[66,822,823],{"class":700},"          tags",[66,825,704],{"class":433},[66,827,828],{"class":437}," harbor.example.com\u002Fmyproject\u002Fmyapp:${{ github.sha }}\n",[66,830,831,834,836],{"class":68,"line":536},[66,832,833],{"class":700},"          cache-from",[66,835,704],{"class":433},[66,837,838],{"class":437}," type=gha\n",[66,840,841,844,846],{"class":68,"line":542},[66,842,843],{"class":700},"          cache-to",[66,845,704],{"class":433},[66,847,848],{"class":437}," type=gha,mode=max\n",[11,850,851,852,857],{},"Using BuildKit's ",[23,853,856],{"href":854,"rel":855},"https:\u002F\u002Fdocs.docker.com\u002Fbuild\u002Fcache\u002Fbackends\u002Fgha\u002F",[27],"GitHub Actions cache backend"," enables cache sharing across ci-cd runs, further reducing build times.",[11,859,860],{},[15,861,862],{},"Production deployment checklist:",[363,864,865,883,890,905,912],{},[366,866,867,868,871,872,875,876,875,879,882],{},"Exclude unnecessary files with ",[39,869,870],{},".dockerignore"," (",[39,873,874],{},".git",", ",[39,877,878],{},"node_modules",[39,880,881],{},".env",", etc.)",[366,884,885,886,889],{},"Run as non-root user (use ",[39,887,888],{},"USER"," instruction)",[366,891,892,893,898,899,904],{},"Integrate vulnerability scanning with ",[23,894,897],{"href":895,"rel":896},"https:\u002F\u002Faquasecurity.github.io\u002Ftrivy\u002F",[27],"Trivy"," or ",[23,900,903],{"href":901,"rel":902},"https:\u002F\u002Fsnyk.io\u002F",[27],"Snyk"," in CI",[366,906,907,908,911],{},"Tag images with commit hashes; avoid using the ",[39,909,910],{},"latest"," tag",[366,913,914,915,920],{},"Follow ",[23,916,919],{"href":917,"rel":918},"https:\u002F\u002Fwww.sysdig.com\u002Flearn-cloud-native\u002Fdockerfile-best-practices",[27],"Sysdig best practices"," — never install unnecessary packages",[31,922,924],{"id":923},"summary-lightweight-secure-and-fast-production-images","Summary: Lightweight, Secure, and Fast Production Images",[11,926,927,928,931,932,935,936,939],{},"Docker multi-stage builds simultaneously deliver ",[15,929,930],{},"image size reduction"," (up to 97%), ",[15,933,934],{},"security hardening"," (reduced attack surface), and ",[15,937,938],{},"faster builds"," (parallel builds and cache utilization).",[11,941,942],{},"By implementing the techniques covered in this article, you can optimize your production container workloads for faster deployments and reduced costs.",[11,944,945,948,949,952],{},[23,946,28],{"href":25,"rel":947},[27]," provides the Kubernetes infrastructure for efficiently running optimized container images. Combined with ",[23,950,298],{"href":296,"rel":951},[27],", AI assists from container builds through deployment, significantly reducing operational overhead.",[11,954,955,956,961],{},"To learn more about container optimization and Kubernetes operations, please ",[23,957,960],{"href":958,"rel":959},"https:\u002F\u002Fwww.hexabase.com\u002Fcontact-us\u002F",[27],"contact us",".",[963,964,965],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sbD-w, html code.shiki .sbD-w{--shiki-default:#51597D;--shiki-default-font-style:italic}html pre.shiki code .sE3pS, html code.shiki .sE3pS{--shiki-default:#C0CAF5}html pre.shiki code .sAklC, html code.shiki .sAklC{--shiki-default:#89DDFF}html pre.shiki code .sPY7s, html code.shiki .sPY7s{--shiki-default:#9ECE6A}html pre.shiki code .sT800, html code.shiki .sT800{--shiki-default:#E0AF68}html pre.shiki code .s0U2E, html code.shiki .s0U2E{--shiki-default:#F7768E}html pre.shiki code .sOJ5S, html code.shiki .sOJ5S{--shiki-default:#FF9E64}html pre.shiki code .sgJMe, html code.shiki .sgJMe{--shiki-default:#9ABDF5}",{"title":62,"searchDepth":75,"depth":75,"links":967},[968,969,970,971,976,977],{"id":33,"depth":75,"text":34},{"id":163,"depth":75,"text":164},{"id":302,"depth":75,"text":303},{"id":457,"depth":75,"text":458,"children":972},[973,974,975],{"id":462,"depth":81,"text":463},{"id":554,"depth":81,"text":555},{"id":614,"depth":81,"text":615},{"id":673,"depth":75,"text":674},{"id":923,"depth":75,"text":924},"2026-05-27","Master Docker multi-stage builds to reduce production images by up to 97%. Learn stage separation, layer caching, distroless base images, and ci-cd integration techniques.","md","en",{},"\u002Fblog\u002Fen\u002Fdocker-multi-stage-build-optimization",{"title":5,"description":979},"blog\u002Fen\u002Fdocker-multi-stage-build-optimization",[987,988,989,990,991,992],"Docker","Multi-Stage Build","Container Optimization","DevOps","ci-cd","Image Size Reduction","ouq9OgVIu95FLlfNGV4KYp-4QSeY2YJcbWXvMxYHa40",1779964618784]