Posts

How to Reduce Docker Image Build Time in CI/CD (GitHub Actions + BuildKit)

Image
How to Slash Docker Build Times in GitHub Actions Using BuildKit Every software team reaches that point where CI pipelines stop feeling like automation and start feeling like a tax. You push a one-line bug fix, open a pull request, and wait twelve minutes while GitHub Actions downloads gigabytes of identical npm packages, compiles static assets from scratch, and rebuilds every container layer sequentially. Multiply those twelve minutes across six engineers shipping four pull requests a day. That is nearly five hours of human waiting time lost every single day, not to mention the monthly GitHub Actions billing bill stacking up silently in the background. The painful reality? Roughly 80% of that time is spent repeating identical work that your runners already executed an hour earlier. Ephemeral cloud runners do not remember anything. By default, every time GitHub spins up a fresh Ubuntu runner, it starts with an empty Docker daemon cache. Unless you explicitly instruct ...

Fixing Docker "Container Can't Reach Container" Networking Issues

Image
Docker Networking Explained: Fixing "Container Can't Reach Container" Issues You spin up a Node API and a Postgres database in Docker. Both start without errors. You try running a migration from your app container to your database container, and it fails outright: Error: connect ECONNREFUSED 127.0.0.1:5432 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) You double-check with docker ps . Both containers are running. You can even query the database from your host machine using DBeaver or psql . Yet, when your backend container tries to ping the database by its container name, it hits a wall: getaddrinfo ENOTFOUND postgres . This is the most common failure point for engineers moving from simple, single-container setups to multi-tier microservices. Docker isolates containers inside distinct network namespaces by default. When an application runs inside a container, localhost points strictly to that container's own internal netw...

Securing Docker Containers in Production: A 10-Point Hardening Checklist

Image
Securing Docker Containers in Production: A 10-Point Hardening Checklist Default Docker settings are built for frictionless developer onboarding, not production safety. When you run docker run -d my-app , Docker provisions a container running as root, with unrestricted access to system memory and CPU, broad Linux kernel capabilities enabled, and an entirely writable filesystem. That setup makes life easy on your local machine. In production, it leaves the door wide open for host takeovers and lateral network movement. Container isolation is fundamentally different from virtual machine isolation. Containers are not isolated hardware slices; they are isolated processes sharing the host Linux kernel through namespaces and control groups (cgroups). If an attacker exploits a remote code execution (RCE) bug inside an unhardened container running as UID 0, they share UID 0 with the host. One kernel vulnerability or misconfigured mount point stands between that process and full ho...

How to Fix Docker 'No Space Left on Device' Without Losing Your Data

Image
How to Fix Docker 'No Space Left on Device' Without Losing Your Data You run a build or start a service with docker compose up , and everything grinds to a halt with this error: ERROR: failed to solve: failed to register layer: write /var/lib/docker/overlay2/...: no space left on device Your local disk looks half empty. You open your file manager and see 80 GB of free storage. Yet Docker insists you are out of room. If this is a CI runner, your deployment pipeline is blocked. If it is your local machine, your containers refuse to spin up. The immediate urge is to run a destructive cleanup command found on Stack Overflow and hope for the best. That works—right until you realize your local Postgres container had uncommitted test migrations and seed data stored in an unmapped volume, now wiped clean. You can clear dozens of gigabytes from Docker safely. The key is understanding what is eating your space, which assets are safe to delete, and which ones cont...