Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Category: Docker

Docker

Use .dockerignore Like .gitignore

- 27.01.26 - ErcanOPAK comment on Use .dockerignore Like .gitignore

node_modules bin obj .git Why it mattersSmaller build context = faster builds, fewer leaks.

Read More
Docker

Multi-Stage Builds = Smaller Images, Faster Deploys

- 26.01.26 - ErcanOPAK comment on Multi-Stage Builds = Smaller Images, Faster Deploys

FROM node:18 AS build RUN npm run build FROM nginx:alpine COPY –from=build /app/dist /usr/share/nginx/html Why it mattersRemoves build junk → secure & tiny images.

Read More
Docker

Why Your Containers Are Slow Even on Powerful Machines

- 25.01.26 - ErcanOPAK comment on Why Your Containers Are Slow Even on Powerful Machines

The problem is usually the base image. # ❌ Heavy FROM mcr.microsoft.com/dotnet/sdk:8.0 # ✅ Lightweight FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine Why this mattersSmaller images = faster pull, faster start, lower memory pressure.

Read More
Docker

Why Multi-Stage Builds Are About Security, Not Size

- 24.01.26 - ErcanOPAK comment on Why Multi-Stage Builds Are About Security, Not Size

Most people say multi-stage builds are for smaller images.Wrong. They’re about attack surface. FROM mcr.microsoft.com/dotnet/sdk AS build WORKDIR /src COPY . . RUN dotnet publish -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet WORKDIR /app COPY –from=build /app . Why it matters: No SDK in production Fewer CVEs Faster cold starts Smaller image is just a side […]

Read More
Docker

The Hidden Reason Your Containers Randomly Die in Production

- 24.01.26 - ErcanOPAK comment on The Hidden Reason Your Containers Randomly Die in Production

Most “random” container crashes are not random at all — they’re OOM kills. By default, Docker containers have no memory awareness unless you explicitly define it. services: api: image: my-api deploy: resources: limits: memory: 512M Why this mattersWithout limits, the container can consume host memory freely.Linux kernel steps in → kills your container → zero […]

Read More
Docker

Docker Builds Are Slow Even with Small Changes

- 23.01.26 - ErcanOPAK comment on Docker Builds Are Slow Even with Small Changes

One line edit → full rebuild. Why it happensCOPY order invalidates cache. Why it mattersCI/CD pipelines slow down. Vital fix COPY *.csproj . RUN dotnet restore COPY . .  

Read More
Docker

Docker Containers Randomly Exit on Windows

- 22.01.26 | 15.02.26 - ErcanOPAK comment on Docker Containers Randomly Exit on Windows

The Mystery: Your Docker image builds perfectly on Linux or CI/CD, but the moment you or a teammate tries to run it on Windows, the container exits instantly with a cryptic exec format error or standard_init_linux.go:211: exec user process caused “no such file or directory”. The Culprit: It’s not your code; it’s the invisible characters […]

Read More
Docker

Docker Images Grow Bigger Every Build

- 21.01.26 - ErcanOPAK comment on Docker Images Grow Bigger Every Build

Same app, bigger image. Why it happensLayer caching invalidated by COPY order. Why it mattersSlower builds, higher registry costs. Smart fixCopy dependency files first, source later.

Read More
Docker

Docker Containers Work Locally but Fail in CI

- 18.01.26 - ErcanOPAK comment on Docker Containers Work Locally but Fail in CI

Same image, different result. WhyMissing environment variables. TipExplicitly define ENV values in Dockerfile.

Read More
Docker

Docker Images Suddenly Grow Huge

- 16.01.26 - ErcanOPAK comment on Docker Images Suddenly Grow Huge

Same app, bigger image. WhyUnoptimized layer ordering. TipPlace rarely changed steps first in Dockerfile.

Read More
Docker

Docker Containers Work Locally but Fail in CI

- 15.01.26 - ErcanOPAK comment on Docker Containers Work Locally but Fail in CI

Local success, CI failure. WhyImplicit local file system assumptions. TipAlways build containers using clean contexts.

Read More
Docker

Docker Images Work but Are Hard to Maintain

- 14.01.26 - ErcanOPAK comment on Docker Images Work but Are Hard to Maintain

Builds succeed, debugging is painful. WhySingle-stage images mix runtime and build tools. TipSeparate build and runtime layers.

Read More
Docker

Docker Builds Get Slower Over Time

- 13.01.26 - ErcanOPAK comment on Docker Builds Get Slower Over Time

Same Dockerfile, slower builds. WhyLayer cache invalidation caused by small file changes. Tip Copy dependency files before source code.

Read More
Docker

Docker Containers Consume More Disk Over Time

- 12.01.26 - ErcanOPAK comment on Docker Containers Consume More Disk Over Time

Even after cleanup. WhyDangling layers and build cache accumulate. Maintenance Tip Schedule periodic build cache pruning.

Read More
Docker

Docker Containers Start Slowly on Restart

- 11.01.26 - ErcanOPAK comment on Docker Containers Start Slowly on Restart

First run is fast, restart is slow. WhyVolume mounts re-initialize filesystem state. Fix Avoid mounting large directories unless necessary.

Read More
Docker

Docker Images Grow Over Time Without Reason

- 07.01.26 - ErcanOPAK comment on Docker Images Grow Over Time Without Reason

Same app, bigger image. WhyLayer cache accumulates unused artifacts. Fix Use multi-stage builds and remove build-time dependencies.

Read More
Docker

Docker Containers Restart in a Loop

- 06.01.26 - ErcanOPAK comment on Docker Containers Restart in a Loop

Exit code 0 but container dies. WhyMain process exits immediately. FixEnsure a blocking foreground process.

Read More
Docker

Docker Build Cache Suddenly Stops Working

- 05.01.26 - ErcanOPAK comment on Docker Build Cache Suddenly Stops Working

Every build starts from scratch. WhyBuild context changes invalidate cache layers. FixUse .dockerignore aggressively.

Read More
Docker

Docker Containers Fail Only in Production

- 04.01.26 - ErcanOPAK comment on Docker Containers Fail Only in Production

Local works perfectly. WhyENV values differ from ARG during build vs runtime. FixUse ENV for runtime, ARG only for build.

Read More
Docker

Docker Containers Work Locally but Fail in CI

- 03.01.26 - ErcanOPAK comment on Docker Containers Work Locally but Fail in CI

Same image, different result. WhyCI runs on a different CPU architecture. FixBuild multi-arch images explicitly.

Read More
Docker

Docker Image Is Huge and Slow

- 03.01.26 - ErcanOPAK comment on Docker Image Is Huge and Slow

Builds take forever. WhyDependencies and source copied in wrong order. Fix COPY *.csproj ./ RUN dotnet restore COPY . .  

Read More
Docker

Docker Container Works Once, Then Fails

- 02.01.26 - ErcanOPAK comment on Docker Container Works Once, Then Fails

First run ok, second run broken. WhyStateful data written inside container layer. Fix Always mount volumes for persistent data.

Read More
Docker

Docker Build Is Slow Even With Cache

- 01.01.26 - ErcanOPAK comment on Docker Build Is Slow Even With Cache

You changed one line… everything rebuilt. Why it happensCOPY instructions invalidate layers. FixCopy dependency files first, source files last.

Read More
Docker

Docker — Containers Slow Because of OverlayFS

- 31.12.25 - ErcanOPAK comment on Docker — Containers Slow Because of OverlayFS

OverlayFS slows heavy file IO. Fix Use volumes for write-heavy paths.

Read More
Docker

Docker — latest Tag Breaks Reproducibility

- 30.12.25 - ErcanOPAK comment on Docker — latest Tag Breaks Reproducibility

latest changes silently. ❌ Risk Unexpected production behavior. ✅ Fix Pin exact image versions.

Read More
Docker

Docker — Layer Order Can Double Image Size

- 28.12.25 | 29.12.25 - ErcanOPAK comment on Docker — Layer Order Can Double Image Size

Bad order: COPY . . RUN npm install ✅ Fix Copy manifests first, install, then source.

Read More
Page 8 of 8
« Previous 1 … 3 4 5 6 7 8

Posts pagination

« Previous 1 … 6 7 8
November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (661)
  • Add Constraint to SQL Table to ensure email contains @ (619)
  • Average of all values in a column that are not zero in SQL (577)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (553)
  • Find numbers with more than two decimal places in SQL (481)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store
  • WordPress: Fix a Navigation Block Losing Submenu Items After Sync
  • Visual Studio: Fix CodeLens Reference Counts Stuck at Stale Numbers
  • C#: Fix a UTF-8 String Literal Behaving Differently in a Switch
  • Photoshop: Fix a Liquify Mesh Snapping Back on a Smart Object
  • The AI Prompt That Turns a Crash Dump Into a Short Repro Script

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com