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

Docker: Fix a Healthcheck Passing While the DB Is Unreachable

- 21.11.26 - ErcanOPAK comment on Docker: Fix a Healthcheck Passing While the DB Is Unreachable

🐳 Docker: Fix a Healthcheck Passing While the DB Is Unreachable A HEALTHCHECK that only calls the app’s own /health endpoint is exactly as deep as whatever that endpoint actually verifies. If it was written as a cheap liveness probe that just confirms the web server thread is responding, the container shows up healthy in […]

Read More
Docker

Docker: Fix a Build Cache Ignoring a Changed ARG Value

- 20.11.26 - ErcanOPAK comment on Docker: Fix a Build Cache Ignoring a Changed ARG Value

🐳 Fix a Build Cache Ignoring a Changed ARG Value Docker’s layer cache keys a layer by the instruction text in the Dockerfile and the build context it consumes, not by the runtime value you pass with –build-arg – so an ARG that’s declared but not actually referenced inside the specific RUN or COPY instruction […]

Read More
Docker

Docker: Fix a Container Losing Logs After a Restart Policy

- 19.11.26 - ErcanOPAK comment on Docker: Fix a Container Losing Logs After a Restart Policy

🐳 Fix a Container Losing Logs After a Restart Policy Docker’s default json-file log driver writes a container’s stdout/stderr to a file tied to that specific container ID; a container with `restart: always` that crashes and comes back under its OWN restart policy keeps the same ID and the same log file, so history should […]

Read More
Docker

Docker: Fix a Healthcheck Marking a Container Unhealthy Too Soon

- 18.11.26 - ErcanOPAK comment on Docker: Fix a Healthcheck Marking a Container Unhealthy Too Soon

🐳 Docker: Fix a Healthcheck Marking a Container Unhealthy Too Soon A Docker HEALTHCHECK runs on a fixed interval starting from the moment the container starts, and every failed probe counts toward the unhealthy threshold unless a start period is configured. An application that genuinely needs real startup time — warming a cache, running migrations, […]

Read More
Docker

Docker: Fix a Multi-Stage Build Caching a Stale npm Install Layer

- 17.11.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Caching a Stale npm Install Layer

🐳 Docker: Fix a Multi-Stage Build Caching a Stale npm Install Layer The standard pattern of copying package.json before the rest of the source so npm install can be cached as its own layer only works if every file that actually determines what gets installed is part of that early COPY — and it’s an […]

Read More
Docker

Docker: Fix a Stale COPY Layer After Editing .dockerignore

- 16.11.26 - ErcanOPAK comment on Docker: Fix a Stale COPY Layer After Editing .dockerignore

🐳 Docker: Fix a Stale COPY Layer After Editing .dockerignore Docker’s build cache keys a COPY instruction’s layer off the content hash of exactly what the build context sends it – and that hash is computed only from the files .dockerignore let through the moment the layer was first cached. Editing .dockerignore to newly exclude […]

Read More
Docker

Docker: Fix a .NET App Crashing Only on Alpine From Missing glibc

- 15.11.26 - ErcanOPAK comment on Docker: Fix a .NET App Crashing Only on Alpine From Missing glibc

🐳 Docker: Fix a .NET App Crashing Only on Alpine From Missing glibc Alpine-based images use musl libc instead of glibc. A .NET app that depends — directly, or through a native dependency like a database driver or an image-processing library shipping a native .so — on glibc-specific symbols runs perfectly on the Debian-based .NET […]

Read More
Docker

Docker: Fix a Healthcheck Reporting Healthy While the App’s Main Thread Sits Fully Deadlocked Because the Probe Only Confirms the Port Is Open

- 14.11.26 - ErcanOPAK comment on Docker: Fix a Healthcheck Reporting Healthy While the App’s Main Thread Sits Fully Deadlocked Because the Probe Only Confirms the Port Is Open

🐳 Fix a Healthcheck Reporting Healthy While the App’s Main Thread Sits Fully Deadlocked Because the Probe Only Confirms the Port Is Open A Docker HEALTHCHECK instruction that just confirms a TCP port accepts a connection, or that a lightweight endpoint returns any HTTP status, is really only testing that the process is alive and […]

Read More
Docker

Docker: Fix a Multi-Stage Build Using Stale Dependencies Because a package.json Comment Edit Never Changed the Cache Key

- 13.11.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Using Stale Dependencies Because a package.json Comment Edit Never Changed the Cache Key

🐳 Docker: Fix a Multi-Stage Build Using Stale Dependencies Because a package.json Comment Edit Never Changed the Cache Key Docker’s layer cache keys a COPY instruction by the exact bytes of the files it copies, which sounds precise enough to trust — but a Dockerfile that copies the whole project directory in one COPY . […]

Read More
Docker

Docker: Fix a Container’s Health Check Reporting Healthy Immediately After Start Because the Check Command Succeeds Before the Entrypoint Script Finishes Its Own Setup

- 12.11.26 - ErcanOPAK comment on Docker: Fix a Container’s Health Check Reporting Healthy Immediately After Start Because the Check Command Succeeds Before the Entrypoint Script Finishes Its Own Setup

🐳 Docker: Fix a Container’s Health Check Reporting Healthy Immediately After Start Because the Check Command Succeeds Before the Entrypoint Script Finishes Its Own Setup A Dockerfile’s `HEALTHCHECK` instruction runs its own command on a fixed interval starting the moment the container’s main process exists — not the moment that process has actually finished whatever […]

Read More
Docker

Docker: Fix a Container Stuck in a Tight Restart Loop With Nothing Ever Printed in docker logs Because the Entrypoint Script Crashes Before Its Output Buffer Gets Flushed to Stdout

- 11.11.26 - ErcanOPAK comment on Docker: Fix a Container Stuck in a Tight Restart Loop With Nothing Ever Printed in docker logs Because the Entrypoint Script Crashes Before Its Output Buffer Gets Flushed to Stdout

🐳 Docker: Fix a Container Stuck in a Tight Restart Loop With Nothing Ever Printed in docker logs Because the Entrypoint Script Crashes Before Its Output Buffer Gets Flushed to Stdout Docker captures whatever a container’s PID 1 process writes to stdout and stderr, but a process that buffers its output — many scripting language […]

Read More
Docker

Docker: Fix ‘No Space Left on Device’ Coming Back Right After a Prune Because BuildKit’s –mount=type=cache Build Cache Isn’t Touched by a Plain docker system prune

- 10.11.26 - ErcanOPAK comment on Docker: Fix ‘No Space Left on Device’ Coming Back Right After a Prune Because BuildKit’s –mount=type=cache Build Cache Isn’t Touched by a Plain docker system prune

🐳 Fix ‘No Space Left on Device’ Coming Back Right After a Prune Because BuildKit’s –mount=type=cache Build Cache Isn’t Touched by a Plain docker system prune A Dockerfile using BuildKit’s RUN –mount=type=cache,target=/path keeps a persistent cache (package manager downloads, compiler output) in its own dedicated cache storage, completely separate from the image layers, stopped containers, […]

Read More
Docker

Docker: Fix a Container’s Health Check Reporting Healthy Right Up Until an OOM Kill Because the Health Check Process Is Exempt From the Container’s Memory Limit

- 09.11.26 - ErcanOPAK comment on Docker: Fix a Container’s Health Check Reporting Healthy Right Up Until an OOM Kill Because the Health Check Process Is Exempt From the Container’s Memory Limit

🐳 Fix a Container’s Health Check Reporting Healthy Right Up Until an OOM Kill Because the Health Check Process Is Exempt From the Container’s Memory Limit A Docker HEALTHCHECK runs as a brief, separately exec’d process inside the container’s namespaces, and because it’s usually a tiny, fast command — a curl against a local endpoint […]

Read More
Docker

Docker: Fix a Multi-Stage Build Reinstalling Every Dependency on Every Code Change Because COPY . . Runs Before the Package Install Step

- 08.11.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Reinstalling Every Dependency on Every Code Change Because COPY . . Runs Before the Package Install Step

🐳 Docker: Fix a Multi-Stage Build Reinstalling Every Dependency on Every Code Change Because COPY . . Runs Before the Package Install Step Docker’s build cache invalidates a layer, and every layer that follows it, the instant any file an earlier COPY instruction reads from changes. Copying the entire project directory with COPY . . […]

Read More
Docker

Docker: Fix a .dockerignore File Having No Effect on a COPY Instruction Because It Was Placed in the Wrong Directory Relative to the Build Context

- 07.11.26 - ErcanOPAK comment on Docker: Fix a .dockerignore File Having No Effect on a COPY Instruction Because It Was Placed in the Wrong Directory Relative to the Build Context

🐳 Docker: Fix a .dockerignore File Having No Effect on a COPY Instruction Because It Was Placed in the Wrong Directory Relative to the Build Context Docker resolves a .dockerignore file relative to the build context root — the directory path you pass as the final argument to docker build — not relative to the […]

Read More
Docker

Docker: Fix a Multi-Stage Build Silently Reusing a Cached Layer From an Older Base Image Because the Tag Was Updated Without Changing Its Name

- 06.11.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Silently Reusing a Cached Layer From an Older Base Image Because the Tag Was Updated Without Changing Its Name

🐳 Docker: Fix a Multi-Stage Build Silently Reusing a Cached Layer From an Older Base Image Because the Tag Was Updated Without Changing Its Name Docker’s build cache keys a FROM instruction’s layer to the base image’s digest at the moment it was last pulled locally, not to whatever the tag currently points to on […]

Read More
Docker

Docker: Fix BuildKit’s Cache Mounts Not Persisting Between CI Runs Because Each Job Spins Up a Fresh, Unrelated Builder Instance

- 05.11.26 - ErcanOPAK comment on Docker: Fix BuildKit’s Cache Mounts Not Persisting Between CI Runs Because Each Job Spins Up a Fresh, Unrelated Builder Instance

🐳 Docker: Fix BuildKit’s Cache Mounts Not Persisting Between CI Runs Because Each Job Spins Up a Fresh, Unrelated Builder Instance A RUN –mount=type=cache instruction persists its cache content inside BuildKit’s own cache storage, keyed to the specific builder instance that ran the build. Most CI providers’ default Docker setup starts a brand-new, ephemeral docker […]

Read More
Docker

Docker: Fix a Service’s Environment Variable Still Showing Its Old Value After Editing .env Because restart Only Restarts the Container Instead of Recreating It

- 04.11.26 - ErcanOPAK comment on Docker: Fix a Service’s Environment Variable Still Showing Its Old Value After Editing .env Because restart Only Restarts the Container Instead of Recreating It

🐳 Fix a Service’s Environment Variable Still Showing Its Old Value After Editing .env Because restart Only Restarts the Container Instead of Recreating It A Compose service’s environment variables — whether they come from the environment: block or an env_file reference — are read once, when the container is created, and baked into that specific […]

Read More
Docker

Docker: Fix a Compose Stack Silently Reusing a Stale Anonymous Volume Because a Service Was Renamed Without Renaming Its Volume

- 02.11.26 - ErcanOPAK comment on Docker: Fix a Compose Stack Silently Reusing a Stale Anonymous Volume Because a Service Was Renamed Without Renaming Its Volume

🐳 Fix a Compose Stack Silently Reusing a Stale Anonymous Volume Because a Service Was Renamed Without Renaming Its Volume A volume declared under Compose’s top-level volumes: section gets its actual Docker-level name from the volume’s own key (or an explicit name: field) — never from whichever service happens to mount it. Rename a service […]

Read More
Docker

Docker: Fix Files Written Inside a Bind-Mounted Volume Becoming Unreadable on the Host Because the Container Process Runs as a UID With No Matching User on the Host

- 01.11.26 - ErcanOPAK comment on Docker: Fix Files Written Inside a Bind-Mounted Volume Becoming Unreadable on the Host Because the Container Process Runs as a UID With No Matching User on the Host

🐳 Fix Files Written Inside a Bind-Mounted Volume Becoming Unreadable on the Host Because the Container Process Runs as a UID With No Matching User on the Host A bind mount shares a host directory directly with a container by exposing the same underlying inode, so file ownership is stored and enforced as a raw […]

Read More
Docker

Docker: Fix a Container’s Healthcheck Reporting Healthy While the App Inside Is Unresponsive Because the Probe Pings a Different Port Than the One Serving Traffic

- 01.11.26 - ErcanOPAK comment on Docker: Fix a Container’s Healthcheck Reporting Healthy While the App Inside Is Unresponsive Because the Probe Pings a Different Port Than the One Serving Traffic

🐳 Fix a Container’s Healthcheck Reporting Healthy While the App Inside Is Unresponsive Because the Probe Pings a Different Port Than the One Serving Traffic A container’s HEALTHCHECK only ever proves that whatever it actually connects to is responding – it says nothing about the process serving real traffic unless the two happen to be […]

Read More
Docker

Docker: Fix Zombie Processes Piling Up Inside a Long-Running Container Because Nothing Reaps Them When the App Forks Without the –init Flag Set

- 01.11.26 - ErcanOPAK comment on Docker: Fix Zombie Processes Piling Up Inside a Long-Running Container Because Nothing Reaps Them When the App Forks Without the –init Flag Set

🐳 Fix Zombie Processes Piling Up Inside a Long-Running Container Because Nothing Reaps Them When the App Forks Without the –init Flag Set On a normal Linux host, PID 1 is init or systemd, and one of its standing jobs is reaping zombie processes — children that have exited but whose exit status hasn’t been […]

Read More
Docker

Docker: Fix a Container Set to Restart Policy unless-stopped Never Coming Back After a Host Reboot Because the Docker Daemon Was Never Enabled to Start on Boot

- 31.10.26 - ErcanOPAK comment on Docker: Fix a Container Set to Restart Policy unless-stopped Never Coming Back After a Host Reboot Because the Docker Daemon Was Never Enabled to Start on Boot

🐳 Fix a Container Set to Restart Policy unless-stopped Never Coming Back After a Host Reboot Because the Docker Daemon Was Never Enabled to Start on Boot Docker’s restart policies are enforced entirely by the Docker daemon itself, which replays each container’s recorded restart policy only during its own startup sequence or when a container […]

Read More
Docker

Docker: Fix docker logs Going Silent for a Running Container Because Changing the Logging Driver in Compose Doesn’t Apply Until the Container Is Recreated

- 31.10.26 - ErcanOPAK comment on Docker: Fix docker logs Going Silent for a Running Container Because Changing the Logging Driver in Compose Doesn’t Apply Until the Container Is Recreated

🐳 Fix docker logs Going Silent for a Running Container Because Changing the Logging Driver in Compose Doesn’t Apply Until the Container Is Recreated Docker bakes a container’s logging driver into its configuration at the exact moment the container is created, which is why docker logs -f keeps working consistently for the life of that […]

Read More
Docker

Docker: Fix a Healthcheck Reporting Healthy Even Though the App Inside Crashed Because the Check Script Tests a Port a Sidecar Process Still Has Open

- 31.10.26 - ErcanOPAK comment on Docker: Fix a Healthcheck Reporting Healthy Even Though the App Inside Crashed Because the Check Script Tests a Port a Sidecar Process Still Has Open

🐳 Fix a Healthcheck Reporting Healthy Even Though the App Inside Crashed Because the Check Script Tests a Port a Sidecar Process Still Has Open A Dockerfile’s HEALTHCHECK instruction runs whatever command it’s given on whatever schedule it’s given, and Docker trusts that command’s exit code completely, with no idea what the command is actually […]

Read More
Docker

Docker: Fix docker exec Landing in a Different Time Zone Than the Main Process Because TZ Was Exported Inside the Entrypoint Script, Not Set as a Dockerfile ENV

- 31.10.26 - ErcanOPAK comment on Docker: Fix docker exec Landing in a Different Time Zone Than the Main Process Because TZ Was Exported Inside the Entrypoint Script, Not Set as a Dockerfile ENV

🐳 Fix docker exec Landing in a Different Time Zone Than the Main Process Because TZ Was Exported Inside the Entrypoint Script, Not Set as a Dockerfile ENV A container’s environment can come from two places that look equivalent but are not. An ENV instruction baked into the image is stored at the image level […]

Read More
Docker

Docker: Fix docker-compose down -v Leaving Old Data Behind Because a Renamed Project Directory Changed the Named Volume’s Generated Prefix

- 30.10.26 - ErcanOPAK comment on Docker: Fix docker-compose down -v Leaving Old Data Behind Because a Renamed Project Directory Changed the Named Volume’s Generated Prefix

🐳 Fix docker-compose down -v Leaving Old Data Behind Because a Renamed Project Directory Changed the Named Volume’s Generated Prefix Compose derives a project name from the directory your docker-compose.yml lives in unless you set one explicitly, and that project name becomes the prefix on every named volume it creates — a volume declared as […]

Read More
Docker

Docker: Fix a Multi-Stage Build Copying an Empty Directory Because the Builder Stage Never Actually Produced the Expected Output Path

- 30.10.26 - ErcanOPAK comment on Docker: Fix a Multi-Stage Build Copying an Empty Directory Because the Builder Stage Never Actually Produced the Expected Output Path

🐳 Fix a Multi-Stage Build Copying an Empty Directory Because the Builder Stage Never Actually Produced the Expected Output Path `COPY –from=builder` only promises to copy whatever exists at that path in the builder stage — it has no concept of whether that directory is supposed to be non-empty. If the builder stage’s actual build […]

Read More
Docker

Docker: Fix a Build Argument’s Value Baked Into an Image Layer Even After You Remove It From the Dockerfile Because the Layer Cache Was Never Invalidated

- 30.10.26 - ErcanOPAK comment on Docker: Fix a Build Argument’s Value Baked Into an Image Layer Even After You Remove It From the Dockerfile Because the Layer Cache Was Never Invalidated

🐳 Fix a Build Argument’s Value Baked Into an Image Layer Even After You Remove It From the Dockerfile Because the Layer Cache Was Never Invalidated A build-time ARG that’s consumed inside a RUN instruction becomes part of the literal content written into that layer’s filesystem diff the moment the RUN executes – the value […]

Read More
Docker

Docker: Fix a Compose Service Stuck in a Tight Restart Loop Because Its Healthcheck Start Period Is Shorter Than the App’s Real Boot Time

- 29.10.26 - ErcanOPAK comment on Docker: Fix a Compose Service Stuck in a Tight Restart Loop Because Its Healthcheck Start Period Is Shorter Than the App’s Real Boot Time

🐳 Fix a Compose Service Stuck in a Tight Restart Loop Because Its Healthcheck Start Period Is Shorter Than the App’s Real Boot Time A healthcheck’s start_period is a grace window during which failures don’t count against the container – but once that window closes, Docker starts counting failed checks toward the configured retries, and […]

Read More
Page 1 of 8
1 2 3 4 5 6 … 8 Next »

Posts pagination

1 2 3 … 8 Next »
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