<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: zaheetdev</title>
    <description>The latest articles on DEV Community by zaheetdev (@zaheetdev).</description>
    <link>https://dev.to/zaheetdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1071618%2Fb30b6cdd-61db-4dd0-8962-40a00290fee4.jpeg</url>
      <title>DEV Community: zaheetdev</title>
      <link>https://dev.to/zaheetdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zaheetdev"/>
    <language>en</language>
    <item>
      <title>To Cache or Not to Cache: A Practical Decision Tree for Engineers</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Sun, 21 Sep 2025 21:45:37 +0000</pubDate>
      <link>https://dev.to/zaheetdev/to-cache-or-not-to-cache-a-practical-decision-tree-for-engineers-2pfi</link>
      <guid>https://dev.to/zaheetdev/to-cache-or-not-to-cache-a-practical-decision-tree-for-engineers-2pfi</guid>
      <description>&lt;h2&gt;
  
  
  To Cache or Not to Cache: A Practical Decision Tree for Engineers
&lt;/h2&gt;

&lt;p&gt;Caching is one of those tools that can make your system feel magically fast—or spectacularly wrong. The trick isn’t &lt;em&gt;how&lt;/em&gt; to cache; it’s &lt;em&gt;when&lt;/em&gt; and &lt;em&gt;what&lt;/em&gt; to cache. Here’s a concise playbook inspired by the “To Cache or Not to Cache” flow many of us sketch on whiteboards, plus a Mermaid diagram you can drop into docs.&lt;/p&gt;




&lt;h2&gt;
  
  
  The decision tree in plain English
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Is it accessed often?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Don’t cache. Save the complexity budget.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; Continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is it expensive to fetch?&lt;/strong&gt; (slow query, external API, heavy compute)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Still don’t cache—your bottleneck isn’t here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; Continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;How stable is the data?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Stable:&lt;/strong&gt; Great cache candidate.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Is it small &amp;amp; simple?&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Consider &lt;strong&gt;partial caching&lt;/strong&gt; (e.g., precomputed aggregates, projections).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; Continue.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Volatile:&lt;/strong&gt; Only proceed if you can &lt;strong&gt;invalidate&lt;/strong&gt; reliably.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No invalidation:&lt;/strong&gt; Avoid caching; correctness beats speed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Have invalidation:&lt;/strong&gt; Use &lt;strong&gt;short TTL&lt;/strong&gt; or &lt;strong&gt;event-driven invalidation&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Does it impact UX or critical internal throughput?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Avoid caching unless it unblocks a heavy internal job.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; Continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is it safe to cache?&lt;/strong&gt; (PII, tenant boundaries, auth scope)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Use &lt;strong&gt;scoped or encrypted keys&lt;/strong&gt;; strip sensitive fields or cache derived artifacts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; Continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Will it scale?&lt;/strong&gt; (key cardinality, memory/eviction, dogpile risk)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No:&lt;/strong&gt; Redesign—shard, precompute, batch, or add a write-through store.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes:&lt;/strong&gt; ✅ &lt;strong&gt;Cache it.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Patterns that pair well with this tree
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cache-aside (lazy):&lt;/strong&gt; App reads→miss→load source→set cache. Simple, flexible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write-through:&lt;/strong&gt; On write, update DB and cache together. Stronger consistency; higher write latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write-behind:&lt;/strong&gt; Buffer writes and update DB asynchronously. Great for throughput; needs durability safeguards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stale-while-revalidate:&lt;/strong&gt; Serve slightly stale data immediately, refresh in background. Excellent UX for stable data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event-driven invalidation:&lt;/strong&gt; Publish domain events (e.g., &lt;code&gt;product.updated&lt;/code&gt;) to evict or refresh keys.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  TTL &amp;amp; invalidation quick guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Highly stable content:&lt;/strong&gt; TTL hours–days, plus manual bust on deploy/version bump.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Moderately dynamic lists:&lt;/strong&gt; TTL minutes; SWR for smooth UX.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volatile counters/prices/stock:&lt;/strong&gt; Event invalidation or TTL seconds; consider moving the truth to a &lt;strong&gt;fast primary&lt;/strong&gt; (e.g., Redis as source-of-truth with periodic snapshot).&lt;/li&gt;
&lt;li&gt;Always include a &lt;strong&gt;version&lt;/strong&gt; (e.g., &lt;code&gt;v3:&lt;/code&gt;) in keys to invalidate wholesale after schema/logic changes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Cache key &amp;amp; security tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope keys&lt;/strong&gt; by tenant/user/locale/feature flags:
&lt;code&gt;inv:v3:tenant:{id}:list?status=overdue&amp;amp;sort=due_at&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never cache raw secrets or PII.&lt;/strong&gt; Cache IDs or rendered views, not sensitive blobs.&lt;/li&gt;
&lt;li&gt;For user-specific views, &lt;strong&gt;bind&lt;/strong&gt; to auth scope and role.&lt;/li&gt;
&lt;li&gt;Consider &lt;strong&gt;request coalescing&lt;/strong&gt; (single-flight) to avoid thundering herds on misses.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Operability checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Track &lt;strong&gt;hit rate&lt;/strong&gt;, &lt;strong&gt;p95 latency&lt;/strong&gt;, &lt;strong&gt;evictions&lt;/strong&gt;, and &lt;strong&gt;origin load&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Implement &lt;strong&gt;graceful degradation&lt;/strong&gt; when cache is cold or unavailable.&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;circuit breakers&lt;/strong&gt; around origins and &lt;strong&gt;dogpile protection&lt;/strong&gt; (locks/jitter).&lt;/li&gt;
&lt;li&gt;Document &lt;strong&gt;who owns&lt;/strong&gt; the invalidation logic.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4by4c9pjmusfmrhmrnxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4by4c9pjmusfmrhmrnxp.png" alt="Cache OR No Cache Decision" width="800" height="2640"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Example: applying the tree
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product catalog page&lt;/strong&gt; (read-heavy, DB joins, updates hourly): Cache-aside, TTL 5–10 min, SWR, event bust on product update.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User dashboard totals&lt;/strong&gt; (expensive aggregates, per-user): Precompute to a &lt;strong&gt;partial cache&lt;/strong&gt; (e.g., nightly job + small deltas), scoped keys, TTL 15–30 min.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live stock levels&lt;/strong&gt; (volatile): Prefer event-driven invalidation or a fast primary store; if caching, TTL seconds with coalesced refresh.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Closing thought
&lt;/h2&gt;

&lt;p&gt;If everything is cached, nothing is reliable. If nothing is cached, nothing is fast. Use the decision tree to protect &lt;strong&gt;correctness first&lt;/strong&gt;, then buy back &lt;strong&gt;latency&lt;/strong&gt; where it matters.&lt;/p&gt;




</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Node.js v24.7.0 Released – Post-Quantum Cryptography, Modern WebCrypto, and More</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Fri, 29 Aug 2025 14:50:32 +0000</pubDate>
      <link>https://dev.to/zaheetdev/nodejs-v2470-released-post-quantum-cryptography-modern-webcrypto-and-more-1df9</link>
      <guid>https://dev.to/zaheetdev/nodejs-v2470-released-post-quantum-cryptography-modern-webcrypto-and-more-1df9</guid>
      <description>&lt;h2&gt;
  
  
  Node.js v24.7.0 – Future-Proof Cryptography, Modern WebCrypto, and More
&lt;/h2&gt;

&lt;p&gt;Released on &lt;strong&gt;August 27, 2025&lt;/strong&gt;, Node.js v24.7.0 (Current) introduces &lt;strong&gt;quantum-resistant cryptography, modern WebCrypto APIs, single executable app improvements, Argon2 password hashing, Brotli streaming, and updated root certificates&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;This release isn’t just a step forward — it’s Node.js preparing for the &lt;strong&gt;future of secure, scalable applications&lt;/strong&gt;.  &lt;/p&gt;




&lt;h2&gt;
  
  
  Post-Quantum Cryptography in &lt;code&gt;node:crypto&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;With the rise of &lt;strong&gt;quantum computing&lt;/strong&gt;, today’s encryption standards risk becoming obsolete. To future-proof Node.js, v24.7.0 introduces &lt;strong&gt;NIST’s post-quantum cryptography standards&lt;/strong&gt;:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ML-KEM (FIPS 203)&lt;/strong&gt; → Module-Lattice-Based &lt;strong&gt;Key Encapsulation Mechanism&lt;/strong&gt;, available via:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;encapsulate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;decapsulate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;generateKeyPairSync&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;crypto&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;publicKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;privateKey&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generateKeyPairSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ml-kem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sharedSecret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ciphertext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;encapsulate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;publicKey&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;sharedSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;decrypted&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decapsulate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;privateKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ciphertext&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;ML-DSA (FIPS 204)&lt;/strong&gt; → Module-Lattice-Based &lt;strong&gt;Digital Signature Algorithm&lt;/strong&gt;, supported in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;verify&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;crypto&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello world&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;privateKey&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isValid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello world&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;publicKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means Node.js applications can now experiment with &lt;strong&gt;quantum-resistant encryption and signatures&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Modern Algorithms in Web Cryptography API
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Web Crypto API&lt;/strong&gt; (&lt;code&gt;globalThis.crypto.subtle&lt;/code&gt;) gets a massive upgrade with &lt;strong&gt;next-gen algorithms&lt;/strong&gt;, bringing Node.js closer to browser parity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AES-OCB (high-performance authenticated encryption)&lt;/li&gt;
&lt;li&gt;ChaCha20-Poly1305 (modern, fast AEAD cipher)&lt;/li&gt;
&lt;li&gt;SHA-3 &amp;amp; SHAKE digests&lt;/li&gt;
&lt;li&gt;ML-KEM &amp;amp; ML-DSA (post-quantum cryptography for WebCrypto)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;subtle.getPublicKey()&lt;/code&gt; – Extract a public key from a &lt;code&gt;CryptoKey&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SubtleCrypto.supports()&lt;/code&gt; – Feature detection for algorithms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subtle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generateKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AES-OCB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;encrypt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;decrypt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;SubtleCrypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;supports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AES-OCB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Single Executable Applications (SEA) – Smarter Config
&lt;/h2&gt;

&lt;p&gt;Node.js &lt;strong&gt;Single Executable Apps (SEA)&lt;/strong&gt; now support runtime arguments (&lt;code&gt;execArgv&lt;/code&gt;) directly in the SEA config.&lt;/p&gt;

&lt;p&gt;Example &lt;code&gt;sea-config.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"myapp.blob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"execArgv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"--no-warnings"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"execArgvExtension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cli"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./myapp &lt;span class="nt"&gt;--node-options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"--max-old-space-size=4096"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes &lt;strong&gt;distributing Node.js apps as binaries&lt;/strong&gt; much more flexible.&lt;/p&gt;




&lt;h2&gt;
  
  
  Root Certificates Updated
&lt;/h2&gt;

&lt;p&gt;The built-in &lt;strong&gt;root CA store&lt;/strong&gt; has been updated to &lt;strong&gt;NSS 3.114&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Certificates Added:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;TrustAsia TLS ECC Root CA&lt;/li&gt;
&lt;li&gt;TrustAsia TLS RSA Root CA&lt;/li&gt;
&lt;li&gt;SwissSign RSA TLS Root CA 2022 - 1&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Certificates Removed:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;GlobalSign Root CA&lt;/li&gt;
&lt;li&gt;Entrust.net Premium 2048 Secure Server CA&lt;/li&gt;
&lt;li&gt;Baltimore CyberTrust Root&lt;/li&gt;
&lt;li&gt;Comodo AAA Services Root&lt;/li&gt;
&lt;li&gt;XRamp Global CA Root&lt;/li&gt;
&lt;li&gt;Go Daddy Class 2 CA&lt;/li&gt;
&lt;li&gt;Starfield Class 2 CA&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Other Notable Changes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Argon2 Password Hashing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;crypto.argon2()&lt;/code&gt; and &lt;code&gt;crypto.argon2Sync()&lt;/code&gt; now available.&lt;/li&gt;
&lt;li&gt;More secure password hashing, alongside &lt;code&gt;scrypt&lt;/code&gt; and &lt;code&gt;bcrypt&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;HTTP Enhancements&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New &lt;code&gt;Agent.agentKeepAliveTimeoutBuffer&lt;/code&gt; option.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;HTTP/2 Updates&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support for raw header arrays in &lt;code&gt;h2Stream.respond()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Streaming Compression&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Brotli support added to &lt;code&gt;CompressionStream&lt;/code&gt; &amp;amp; &lt;code&gt;DecompressionStream&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Downloads &amp;amp; Docs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/dist/v24.7.0/" rel="noopener noreferrer"&gt;Node.js v24.7.0 Downloads&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/docs/v24.7.0/api/" rel="noopener noreferrer"&gt;API Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Node.js v24.7.0 is a &lt;strong&gt;future-ready release&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quantum-resistant cryptography ensures long-term security.&lt;/li&gt;
&lt;li&gt;Modern WebCrypto parity keeps Node.js aligned with browsers.&lt;/li&gt;
&lt;li&gt;SEA improvements make binary distribution practical.&lt;/li&gt;
&lt;li&gt;Argon2 + Brotli improve security and performance.&lt;/li&gt;
&lt;li&gt;Updated CAs strengthen TLS trust.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re building secure, scalable apps with Node.js, this is a release you’ll want to explore right away.&lt;/p&gt;




&lt;p&gt;👉 What feature are you most excited about in Node.js v24.7.0?&lt;br&gt;
Let’s discuss in the comments!&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>security</category>
      <category>opensource</category>
    </item>
    <item>
      <title>🔐 Kubernetes Secrets &amp; ConfigMaps: Securely Manage Your App Configurations</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Sun, 27 Jul 2025 23:00:35 +0000</pubDate>
      <link>https://dev.to/zaheetdev/kubernetes-secrets-configmaps-securely-manage-your-app-configurations-52pk</link>
      <guid>https://dev.to/zaheetdev/kubernetes-secrets-configmaps-securely-manage-your-app-configurations-52pk</guid>
      <description>&lt;p&gt;Managing your app configurations and secrets securely is &lt;strong&gt;non-negotiable&lt;/strong&gt; in modern cloud-native development. Kubernetes offers two native resources to do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🛠 &lt;strong&gt;ConfigMaps&lt;/strong&gt; for non-sensitive configuration&lt;/li&gt;
&lt;li&gt;🔐 &lt;strong&gt;Secrets&lt;/strong&gt; for credentials, tokens, and other sensitive values&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In this guide, we’ll show how to use both in a real-world Node.js app deployed to Kubernetes.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ✨ What You'll Learn
&lt;/h2&gt;

&lt;p&gt;✅ Difference between ConfigMaps and Secrets&lt;br&gt;&lt;br&gt;
✅ Creating secure configurations using YAML&lt;br&gt;&lt;br&gt;
✅ Deploying a Node.js app with injected env vars&lt;br&gt;&lt;br&gt;
✅ Debugging and accessing environment inside the container&lt;br&gt;&lt;br&gt;
✅ Docker + Kubernetes best practices for configuration&lt;/p&gt;


&lt;h2&gt;
  
  
  📦 Demo Image &amp;amp; Source Code
&lt;/h2&gt;

&lt;p&gt;We're using a public Docker image that reads environment variables and returns them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📦 Docker: &lt;a href="https://hub.docker.com/r/zaheetdeveloper/k8s-config-demo" rel="noopener noreferrer"&gt;&lt;code&gt;zaheetdeveloper/k8s-config-demo&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🧪 Code + YAMLs: &lt;a href="https://github.com/zaheetdev/k8s-config-demo" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  📁 Project Structure
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k8s-config-demo/
├── index.js
├── Dockerfile
├── configmap.yaml
├── secret.yaml
└── deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 Why ConfigMaps &amp;amp; Secrets?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;ConfigMap&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores non-sensitive values like &lt;code&gt;APP_MODE&lt;/code&gt;, URLs, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Secret&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores sensitive data like &lt;code&gt;DB_USER&lt;/code&gt;, &lt;code&gt;DB_PASSWORD&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Encoded in Base64 and supports encryption at rest&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using them ensures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔐 You don’t hardcode values&lt;/li&gt;
&lt;li&gt;🔁 You can change config without rebuilding the image&lt;/li&gt;
&lt;li&gt;🧩 They integrate cleanly into deployments&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  🧰 The Application Code (&lt;code&gt;index.js&lt;/code&gt;)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DB_USER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_USER&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DB_PASSWORD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;APP_MODE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;APP_MODE&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Mode: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;APP_MODE&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, DB_USER: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;DB_USER&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Server running on port &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🐳 Dockerfile
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:alpine&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; index.js .&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["node", "index.js"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Build and push (already done):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; zaheetdeveloper/k8s-config-demo:v1 &lt;span class="nb"&gt;.&lt;/span&gt;
docker push zaheetdeveloper/k8s-config-demo:v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔧 Step-by-Step Kubernetes Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1️⃣ Create the ConfigMap
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-config&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;APP_MODE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; configmap.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F446mkpr8ck3oezguqso6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F446mkpr8ck3oezguqso6.png" alt="Config creation successful" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  2️⃣ Create the Secret
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;db-secret&lt;/span&gt;
&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Opaque&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;DB_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;YWRtaW4=&lt;/span&gt;       &lt;span class="c1"&gt;# 'admin'&lt;/span&gt;
  &lt;span class="na"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;c2VjdXJl&lt;/span&gt;   &lt;span class="c1"&gt;# 'secure'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; secret.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffuxbqtvs2teve2e85has.png" alt="Creating Secrets with kubectl" width="800" height="241"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3️⃣ Create the Deployment
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-config-test&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config-app&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config-app&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;automountServiceAccountToken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-container&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;zaheetdeveloper/k8s-config-demo:v1&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;APP_MODE&lt;/span&gt;
          &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;configMapKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-config&lt;/span&gt;
              &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;APP_MODE&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB_USER&lt;/span&gt;
          &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;secretKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;db-secret&lt;/span&gt;
              &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB_USER&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB_PASSWORD&lt;/span&gt;
          &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;secretKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;db-secret&lt;/span&gt;
              &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DB_PASSWORD&lt;/span&gt;
        &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3000&lt;/span&gt;
        &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;100m"&lt;/span&gt;
            &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;128Mi"&lt;/span&gt;
            &lt;span class="na"&gt;ephemeral-storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;128Mi"&lt;/span&gt;
          &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;500m"&lt;/span&gt;
            &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;512Mi"&lt;/span&gt;
            &lt;span class="na"&gt;ephemeral-storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;512Mi"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feoqksbnl9evz6u9pcwke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feoqksbnl9evz6u9pcwke.png" alt="App Deployment and Get Pods Screenshot" width="800" height="96"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧪 Testing &amp;amp; Debugging
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods
kubectl logs &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;config-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server running on port 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8b5w9n8j0t1w22x1sdko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8b5w9n8j0t1w22x1sdko.png" alt="App Logs Screenshot" width="800" height="81"&gt;&lt;/a&gt;&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl port-forward deployment/app-config-test 3000:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit in browser: &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7yd2f657t44t37xnp7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7yd2f657t44t37xnp7g.png" alt="App NodeJs Browser Screenshot" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; pod/&amp;lt;pod-name&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; /bin/sh
&lt;span class="nb"&gt;env&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftp9plv19v1v21n2u7v4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftp9plv19v1v21n2u7v4y.png" alt="App Bash and its env Screenshot" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🛡️ Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Encrypt secrets at rest using KMS&lt;/li&gt;
&lt;li&gt;Avoid storing secrets in source code&lt;/li&gt;
&lt;li&gt;Use RBAC to control access&lt;/li&gt;
&lt;li&gt;Explore tools like Sealed Secrets or External Secrets Operator&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💬 Conclusion
&lt;/h2&gt;

&lt;p&gt;You now know how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use ConfigMaps and Secrets in Kubernetes&lt;/li&gt;
&lt;li&gt;Inject them securely into containers&lt;/li&gt;
&lt;li&gt;Deploy and inspect a working environment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➡️ &lt;strong&gt;Demo image:&lt;/strong&gt; &lt;a href="https://hub.docker.com/r/zaheetdeveloper/k8s-config-demo" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt;&lt;br&gt;&lt;br&gt;
📂 &lt;strong&gt;Source code &amp;amp; YAMLs:&lt;/strong&gt; &lt;a href="https://github.com/zaheetdev/k8s-config-demo" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>yaml</category>
      <category>security</category>
    </item>
    <item>
      <title>🚀 Deploying Your First App on Kubernetes (With YAML Examples)</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Mon, 19 May 2025 23:38:05 +0000</pubDate>
      <link>https://dev.to/zaheetdev/deploying-your-first-app-on-kubernetes-with-yaml-examples-42ee</link>
      <guid>https://dev.to/zaheetdev/deploying-your-first-app-on-kubernetes-with-yaml-examples-42ee</guid>
      <description>&lt;p&gt;Kubernetes can feel overwhelming at first , all the YAML, pods, deployments, services... But once you deploy your first app, things start to click.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll walk through deploying a simple &lt;strong&gt;Nginx web server&lt;/strong&gt; to a Kubernetes cluster, using just a few YAML files.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 What We’re Deploying
&lt;/h2&gt;

&lt;p&gt;We’ll use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Deployment&lt;/strong&gt; – to manage our pods&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Service&lt;/strong&gt; – to expose our app&lt;/li&gt;
&lt;li&gt;Optionally, a &lt;strong&gt;NodePort&lt;/strong&gt; – to access it from a browser&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📦 Step 1: Create a Deployment
&lt;/h2&gt;

&lt;p&gt;Let’s create a deployment to run two replicas of the &lt;code&gt;nginx&lt;/code&gt; container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File: &lt;code&gt;nginx-deployment.yaml&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.25
        ports:
        - containerPort: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Apply it:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f nginx-deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Check status:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get deployments
kubectl get pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🌐 Step 2: Expose the App with a Service
&lt;/h2&gt;

&lt;p&gt;To make the app accessible, define a Service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File: &lt;code&gt;nginx-service.yaml&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
  type: NodePort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Apply it:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f nginx-service.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Check the port:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get svc nginx-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Look for the &lt;code&gt;NodePort&lt;/code&gt;, e.g., &lt;code&gt;30007&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🌍 Step 3: Access the App
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you're using &lt;strong&gt;Minikube&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube service nginx-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you're using &lt;strong&gt;Docker Desktop&lt;/strong&gt; or a cloud cluster:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open &lt;code&gt;http://&amp;lt;NODE-IP&amp;gt;:&amp;lt;NODE-PORT&amp;gt;&lt;/code&gt; in your browser.&lt;/p&gt;




&lt;h2&gt;
  
  
  📜 Bonus: Clean Up
&lt;/h2&gt;

&lt;p&gt;To delete the resources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete -f nginx-deployment.yaml
kubectl delete -f nginx-service.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧠 Summary
&lt;/h2&gt;

&lt;p&gt;You just:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Created a Kubernetes deployment for Nginx&lt;/li&gt;
&lt;li&gt;Exposed it using a service&lt;/li&gt;
&lt;li&gt;Accessed it via browser or CLI&lt;/li&gt;
&lt;li&gt;Learned the basics of &lt;code&gt;kubectl&lt;/code&gt; and YAML syntax&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🧭 Next Steps
&lt;/h2&gt;

&lt;p&gt;Try:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replacing Nginx with your own app image&lt;/li&gt;
&lt;li&gt;Using ConfigMaps or Secrets for configuration&lt;/li&gt;
&lt;li&gt;Exploring Ingress controllers&lt;/li&gt;
&lt;li&gt;Scaling your deployment with &lt;code&gt;kubectl scale&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;#kubernetes #devops #k8s #containers #yaml #cloudnative&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>cloudnative</category>
      <category>docker</category>
    </item>
    <item>
      <title>Why Less Code Might Just Save Your Startup?</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Mon, 12 May 2025 23:01:15 +0000</pubDate>
      <link>https://dev.to/zaheetdev/why-less-code-might-just-save-your-startup-4le0</link>
      <guid>https://dev.to/zaheetdev/why-less-code-might-just-save-your-startup-4le0</guid>
      <description>&lt;p&gt;Here's a &lt;strong&gt;DEV.to blog post&lt;/strong&gt; version of your idea, with a clear title, engaging introduction, key points, and a reflective conclusion:&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Less Code Might Just Save Your Startup
&lt;/h1&gt;

&lt;p&gt;If you're in the early stages of building a product, here's a truth bomb: &lt;strong&gt;Every line of code you write is a liability, not an asset&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This might feel counterintuitive, after all, developers are builders, and writing code is how we get things done. But in a world where speed, clarity, and focus are your greatest weapons, shipping too much too fast in the wrong direction can sink you before you even get traction.&lt;/p&gt;

&lt;p&gt;Let’s talk about why writing &lt;em&gt;less&lt;/em&gt; code is often the smarter move, and what you should focus on instead.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Cost of Code
&lt;/h2&gt;

&lt;p&gt;Code isn't free, &lt;em&gt;not even to yourself&lt;/em&gt;. Here's what comes with every new line:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance:&lt;/strong&gt; More code means more things to break, debug, and refactor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complexity:&lt;/strong&gt; As the codebase grows, every change becomes riskier and slower.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Opportunity Cost:&lt;/strong&gt; Time spent over-engineering could be used validating ideas or talking to users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Startups don't die from lack of features.&lt;br&gt;
They die from complexity.&lt;/p&gt;




&lt;h2&gt;
  
  
  Focus On What Actually Matters
&lt;/h2&gt;

&lt;p&gt;The startups that win tend to excel in a few specific areas:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Dead-Simple UX&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Users shouldn’t have to think. The best products feel obvious. Clear design and focused flows win over bloated dashboards every time.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Speed of Iteration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You don’t need perfect code. You need feedback. Fast feedback. Build → Ship → Learn → Repeat.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;One Painful Problem, Solved Exceptionally&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Not three mediocre features. Not ten average solutions. One pain. Crushed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Example: Stripe
&lt;/h2&gt;

&lt;p&gt;Stripe didn’t try to build an entire financial suite out of the gate.&lt;br&gt;
They made online payments &lt;em&gt;painless&lt;/em&gt; for developers.&lt;br&gt;
That core painkiller became the wedge for massive growth.&lt;/p&gt;




&lt;h2&gt;
  
  
  What You Can Do Right Now
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cut features that aren't absolutely necessary&lt;/li&gt;
&lt;li&gt;Prioritize "time to validate" over "time to polish"&lt;/li&gt;
&lt;li&gt;Treat code as debt unless it solves a validated need&lt;/li&gt;
&lt;li&gt;Use no-code or low-code tools early when speed matters more than scalability&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;More code isn’t progress.&lt;br&gt;
&lt;strong&gt;More clarity is.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So next time you’re tempted to build that “one more feature,” ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Will this help me solve a real problem faster?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If not, delete it.&lt;br&gt;
Move faster.&lt;br&gt;
Win bigger.&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 What’s your experience with code complexity in early-stage projects? Share your war stories in the comments!
&lt;/h3&gt;

</description>
      <category>startup</category>
      <category>code</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>🧠 Kubernetes for Absolute Beginners: Architecture &amp; Core Components</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Mon, 12 May 2025 00:24:27 +0000</pubDate>
      <link>https://dev.to/zaheetdev/kubernetes-for-absolute-beginners-architecture-core-components-814</link>
      <guid>https://dev.to/zaheetdev/kubernetes-for-absolute-beginners-architecture-core-components-814</guid>
      <description>&lt;p&gt;Hey folks! 👋&lt;br&gt;
Ever felt like Kubernetes is just too much to wrap your head around?&lt;/p&gt;

&lt;p&gt;You're not alone.&lt;/p&gt;

&lt;p&gt;When I first started exploring Kubernetes (a.k.a. &lt;strong&gt;K8s&lt;/strong&gt;), it felt like being dropped into a massive orchestra of pods, nodes, and weird words like "kubelet" and "etcd". But don't worry , if you’ve built a few Docker containers or just want to understand what all the K8s buzz is about, this post will break it down &lt;em&gt;nice and easy&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Let’s dive in.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 What is Kubernetes (K8s)?
&lt;/h2&gt;

&lt;p&gt;Kubernetes is an open-source system created by Google that helps you &lt;strong&gt;deploy, scale, and manage containerized applications&lt;/strong&gt;. Think of it as the brain that tells your containers &lt;em&gt;where to run&lt;/em&gt;, &lt;em&gt;how many to run&lt;/em&gt;, and &lt;em&gt;what to do if something breaks&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So instead of managing 100 containers manually, Kubernetes does the heavy lifting. Cool, right?&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 Why Use Kubernetes?
&lt;/h2&gt;

&lt;p&gt;Let’s say you’re building an app that has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A frontend&lt;/li&gt;
&lt;li&gt;A backend API&lt;/li&gt;
&lt;li&gt;A database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the microservices world, you’d likely package each part into its own container. But how do you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy all of them reliably?&lt;/li&gt;
&lt;li&gt;Scale them up during peak hours?&lt;/li&gt;
&lt;li&gt;Restart them if they crash?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;That’s the magic of Kubernetes.&lt;/strong&gt; ✨&lt;/p&gt;

&lt;p&gt;It handles all this automatically so you can focus on your app, not the infrastructure drama.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 Kubernetes Architecture: Two Main Types of Nodes
&lt;/h2&gt;

&lt;p&gt;Kubernetes is like a team. Every team has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The brains (Master Node / Control Plane)&lt;/strong&gt; 🧠&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The workers (Worker Nodes)&lt;/strong&gt; 💪&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9m1macqjiltjca7sopvj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9m1macqjiltjca7sopvj.png" alt="Core-components-kubectl/kubernetes" width="800" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Master Node&lt;/strong&gt; – The Boss
&lt;/h3&gt;

&lt;p&gt;This is where the big decisions are made: scheduling, scaling, and managing the whole cluster.&lt;/p&gt;

&lt;p&gt;Key components in the Master Node:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API Server&lt;/strong&gt; (&lt;code&gt;kube-apiserver&lt;/code&gt;) – The front door of the cluster. Every request goes through here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduler&lt;/strong&gt; (&lt;code&gt;kube-scheduler&lt;/code&gt;) – Decides &lt;em&gt;where&lt;/em&gt; a new pod should run based on available resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controller Manager&lt;/strong&gt; (&lt;code&gt;kube-controller-manager&lt;/code&gt;) – Watches everything and fixes issues (like restarting crashed pods).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;etcd&lt;/strong&gt; – A lightweight key-value store where cluster state and config are saved. Think of it as K8s’ memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Worker Node&lt;/strong&gt; – The Doers
&lt;/h3&gt;

&lt;p&gt;This is where your actual apps (pods/containers) run.&lt;/p&gt;

&lt;p&gt;Key components in each Worker Node:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kubelet&lt;/strong&gt; – Talks to the master node, ensures containers run as expected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container Runtime&lt;/strong&gt; – The software that runs the containers (like Docker or containerd).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kube-Proxy&lt;/strong&gt; – Manages network traffic so services can talk to each other smoothly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧩 Core Kubernetes Components (The Building Blocks)
&lt;/h2&gt;

&lt;p&gt;These are the things you’ll interact with the most as a developer:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pod&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Smallest unit in K8s; wraps around one or more containers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Service&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Exposes a group of pods to other services or the internet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ingress&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manages external HTTP traffic into the cluster.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ConfigMap&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stores config data (like environment variables) separately from code.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Secret&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Like ConfigMap, but for sensitive data (passwords, tokens).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Volume&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Allows containers to store data that survives restarts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Defines how to deploy stateless apps (like your frontend).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;StatefulSet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;For deploying stateful apps like databases, where order and identity matter.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🛠️ TL;DR – What Happens Behind the Scenes?
&lt;/h2&gt;

&lt;p&gt;Here’s a quick example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You tell Kubernetes: “Hey, I want 3 replicas of my app running.”&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;API Server&lt;/strong&gt; hears you and stores the request in &lt;strong&gt;etcd&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Scheduler&lt;/strong&gt; picks the best Worker Nodes.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Controller&lt;/strong&gt; ensures the right number of pods are always running.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Kubelet&lt;/strong&gt; on the selected nodes spins up the pods.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kube-Proxy&lt;/strong&gt; ensures everything can talk to each other.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Boom 💥 – your app is up and running, at scale.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Kubernetes might seem complex at first, but once you break it down, it’s just a well-organized system doing smart things for your containers.&lt;/p&gt;

&lt;p&gt;Start with the &lt;strong&gt;big picture&lt;/strong&gt;, understand the &lt;strong&gt;core components&lt;/strong&gt;, and don’t worry about mastering everything all at once.&lt;/p&gt;

&lt;p&gt;Just remember: every expert was once a beginner 🙌&lt;/p&gt;




&lt;p&gt;If this helped you understand Kubernetes a bit better, drop a 💙 or share it with someone who's also getting started.&lt;/p&gt;

&lt;p&gt;I’ll be posting &lt;strong&gt;Part 2&lt;/strong&gt; soon where we’ll explore &lt;strong&gt;Deployments, Services, and Ingress&lt;/strong&gt; in action , with hands-on examples.&lt;/p&gt;

&lt;p&gt;Until next time,&lt;br&gt;
Happy containerizing 🚢&lt;/p&gt;




</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>docker</category>
      <category>containers</category>
    </item>
    <item>
      <title>🚀 Shrink Your Docker Image by 800%: Multi-Stage Builds &amp; Minimal Base Magic</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Fri, 09 May 2025 17:49:16 +0000</pubDate>
      <link>https://dev.to/zaheetdev/shrink-your-docker-image-by-800-multi-stage-builds-minimal-base-magic-2h09</link>
      <guid>https://dev.to/zaheetdev/shrink-your-docker-image-by-800-multi-stage-builds-minimal-base-magic-2h09</guid>
      <description>&lt;p&gt;Reducing Docker image sizes isn't just a nice-to-have—it's essential when you're deploying at scale. Bloated images lead to slower CI/CD pipelines, larger attack surfaces, and higher cloud bills. But what if you could cut a &lt;strong&gt;1GB image down to just 30MB&lt;/strong&gt;? 🚀&lt;/p&gt;

&lt;p&gt;By combining &lt;strong&gt;Multi-Stage Builds&lt;/strong&gt; with &lt;strong&gt;slim or distroless base images&lt;/strong&gt;, you can drastically reduce image size without sacrificing functionality or speed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frljujn2ziz4ngfbhadse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frljujn2ziz4ngfbhadse.png" alt="Multi-Stage-Build-distroless-image" width="800" height="735"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 The Basics: Multi-Stage Docker Builds
&lt;/h2&gt;

&lt;p&gt;Multi-stage builds allow you to use multiple &lt;code&gt;FROM&lt;/code&gt; statements in a single Dockerfile. This lets you separate the &lt;strong&gt;build environment&lt;/strong&gt; (which might be heavy with tools and dependencies) from the &lt;strong&gt;runtime environment&lt;/strong&gt; (which should be as slim as possible).&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 Typical Setup Looks Like This:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1️⃣ &lt;strong&gt;Build Stage&lt;/strong&gt;:
&lt;/h4&gt;

&lt;p&gt;Start with a full-featured image like &lt;code&gt;golang&lt;/code&gt;, &lt;code&gt;node&lt;/code&gt;, or even &lt;code&gt;ubuntu&lt;/code&gt;.&lt;br&gt;
This is where you install dependencies, compile source code, and run tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;golang:1.20&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;builder&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;go build &lt;span class="nt"&gt;-o&lt;/span&gt; myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2️⃣ &lt;strong&gt;Production Stage&lt;/strong&gt;:
&lt;/h4&gt;

&lt;p&gt;Use a lightweight or distroless base image like &lt;code&gt;alpine&lt;/code&gt; or Google's &lt;code&gt;gcr.io/distroless/base&lt;/code&gt;.&lt;br&gt;
Only copy the final artifact.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; alpine:latest&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder /app/myapp .&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["./myapp"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📉 &lt;strong&gt;Result&lt;/strong&gt;:&lt;br&gt;
Image shrinks from ~400MB to &lt;strong&gt;15MB&lt;/strong&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Why Slim and Distroless Images Matter
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Smaller size&lt;/strong&gt; → Faster deployments and fewer storage costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower attack surface&lt;/strong&gt; → Minimal OS footprint means fewer vulnerabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better performance&lt;/strong&gt; → Streamlined startup and resource consumption.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Distroless Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; gcr.io/distroless/static&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder /app/myapp /&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["/myapp"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Final size? As low as &lt;strong&gt;1.8MB&lt;/strong&gt;! 🧊&lt;/p&gt;




&lt;h2&gt;
  
  
  🔥 Real World Gains
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Image Size&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Traditional Docker&lt;/td&gt;
&lt;td&gt;~400MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-Stage + Alpine&lt;/td&gt;
&lt;td&gt;~15MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Distroless&lt;/td&gt;
&lt;td&gt;~1.8MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Yes, that's an &lt;strong&gt;800%+ reduction&lt;/strong&gt;. It's like going from a cargo ship to a jet ski. 🚤&lt;/p&gt;




&lt;h2&gt;
  
  
  📦 Tips for Even Smaller Images
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;.dockerignore&lt;/code&gt; to exclude unnecessary files.&lt;/li&gt;
&lt;li&gt;Avoid installing dev tools in production layers.&lt;/li&gt;
&lt;li&gt;Clean up temporary files and cache during build steps.&lt;/li&gt;
&lt;li&gt;Target statically linked binaries when possible.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Optimizing Docker images is one of the easiest wins in your DevOps toolkit.&lt;br&gt;
With &lt;strong&gt;multi-stage builds&lt;/strong&gt; and &lt;strong&gt;minimal base images&lt;/strong&gt;, you can keep things lean, secure, and lightning-fast.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏷️ Tags
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;#docker&lt;/code&gt; &lt;code&gt;#devops&lt;/code&gt; &lt;code&gt;#containers&lt;/code&gt; &lt;code&gt;#kubernetes&lt;/code&gt; &lt;code&gt;#distroless&lt;/code&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>containers</category>
      <category>cloud</category>
    </item>
    <item>
      <title>🐳 Understanding Docker's Default Bridge Network (With Diagram)</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Mon, 05 May 2025 20:32:16 +0000</pubDate>
      <link>https://dev.to/zaheetdev/understanding-dockers-default-bridge-network-with-diagram-4nno</link>
      <guid>https://dev.to/zaheetdev/understanding-dockers-default-bridge-network-with-diagram-4nno</guid>
      <description>&lt;p&gt;If you've ever spun up a Docker container and wondered &lt;em&gt;how does this thing talk to the internet?&lt;/em&gt;, you’re not alone.&lt;/p&gt;

&lt;p&gt;Docker quietly builds a tiny virtual world behind the scenes — with bridges, fake Ethernet cables (veth), and routing tables. In this post, we'll walk through &lt;strong&gt;how Docker’s default &lt;code&gt;bridge&lt;/code&gt; network actually works&lt;/strong&gt;, using a &lt;strong&gt;diagram-based example&lt;/strong&gt;. Ready? Let’s go! 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Quick Overview
&lt;/h2&gt;

&lt;p&gt;When you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker places your container on a network called &lt;code&gt;bridge&lt;/code&gt; (unless you tell it otherwise). This &lt;code&gt;bridge&lt;/code&gt; is a &lt;strong&gt;virtual switch&lt;/strong&gt; inside your host.&lt;/p&gt;

&lt;p&gt;Your container:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gets its own &lt;strong&gt;virtual Ethernet interface&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Talks to other containers via the bridge&lt;/li&gt;
&lt;li&gt;Reaches the outside world via &lt;strong&gt;NAT routing&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s break this down visually.&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Diagram Walkthrough
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fqr2i3xyo6h59kpxj32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fqr2i3xyo6h59kpxj32.png" alt="docker-bridge-example" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This diagram shows three containers (&lt;code&gt;busybox&lt;/code&gt;, &lt;code&gt;nginx&lt;/code&gt;, &lt;code&gt;busybox-sec&lt;/code&gt;) connected to Docker's default bridge network on the host.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here’s what’s going on, step by step:&lt;/p&gt;




&lt;h3&gt;
  
  
  🐳 1. Each Container Gets a Virtual Ethernet Pair
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each container has an &lt;code&gt;eth0&lt;/code&gt; interface inside.&lt;/li&gt;
&lt;li&gt;This interface is actually one end of a &lt;strong&gt;virtual Ethernet pair&lt;/strong&gt; (&lt;code&gt;veth&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The other end of that pair is connected to Docker’s bridge (&lt;code&gt;docker0&lt;/code&gt;) on the host.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like a wire with two ends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One end inside the container (&lt;code&gt;eth0&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;One end inside the host (&lt;code&gt;vethXYZ&lt;/code&gt;), plugged into the virtual switch&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🧱 2. Docker Bridge (&lt;code&gt;docker0&lt;/code&gt;) Acts Like a Router
&lt;/h3&gt;

&lt;p&gt;The green block labeled &lt;code&gt;Docker 0&lt;/code&gt; is the bridge network:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It connects all the container-side &lt;code&gt;veth&lt;/code&gt; interfaces&lt;/li&gt;
&lt;li&gt;It routes traffic between containers&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;NATs&lt;/strong&gt; outbound traffic to go through the host's &lt;code&gt;eth0&lt;/code&gt; interface&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simpler terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;nginx&lt;/code&gt; pings &lt;code&gt;busybox&lt;/code&gt;, the packets go via &lt;code&gt;docker0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;nginx&lt;/code&gt; accesses Google, Docker rewrites the source IP to the host’s IP&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🌐 3. Outbound Traffic Flows to the Internet
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A container sends a request to &lt;code&gt;www&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;That packet travels via its &lt;code&gt;veth&lt;/code&gt; → &lt;code&gt;docker0&lt;/code&gt; → host's &lt;code&gt;eth0&lt;/code&gt; → your home &lt;strong&gt;router&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The router forwards the packet to the public internet&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Docker handles the &lt;strong&gt;source NAT&lt;/strong&gt; (SNAT), so from the outside world, it looks like the &lt;strong&gt;host made the request&lt;/strong&gt;, not the container.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Key Advantages of Bridge Networking
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Easy to use: default for most containers&lt;/li&gt;
&lt;li&gt;✅ Isolated: containers have private IPs&lt;/li&gt;
&lt;li&gt;✅ Inter-container communication supported&lt;/li&gt;
&lt;li&gt;✅ Internet access via NAT&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚫 But There Are Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;❌ No DNS resolution by default (use custom networks for that)&lt;/li&gt;
&lt;li&gt;❌ Not ideal for inter-host communication&lt;/li&gt;
&lt;li&gt;❌ Some port mapping gymnastics needed (&lt;code&gt;-p 8080:80&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Pro Tip
&lt;/h2&gt;

&lt;p&gt;If you want &lt;strong&gt;named service discovery&lt;/strong&gt; (e.g., call &lt;code&gt;db:5432&lt;/code&gt; instead of an IP), use a &lt;strong&gt;custom bridge network&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create mynet
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; db &lt;span class="nt"&gt;--network&lt;/span&gt; mynet postgres
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--network&lt;/span&gt; mynet myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;myapp&lt;/code&gt; can talk to &lt;code&gt;db&lt;/code&gt; using its &lt;strong&gt;container name&lt;/strong&gt;. 🚀&lt;/p&gt;




&lt;h2&gt;
  
  
  💬 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The bridge network is Docker’s quiet little miracle — simple, powerful, and hidden in plain sight.&lt;/p&gt;

&lt;p&gt;That said, as your architecture grows, you'll want to explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom bridge networks for service discovery&lt;/li&gt;
&lt;li&gt;Host networking for performance&lt;/li&gt;
&lt;li&gt;Overlay networks for multi-host setups (next post!)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Did this help make things clearer?&lt;br&gt;
If so, follow me for more hands-on Docker and DevOps breakdowns!&lt;br&gt;
Let’s de-mystify containers — one diagram at a time.&lt;/p&gt;

&lt;p&gt;✍️ &lt;a href="https://www.linkedin.com/in/zaheet-batada/" rel="noopener noreferrer"&gt;@zaheetdev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>networking</category>
      <category>devops</category>
      <category>container</category>
    </item>
    <item>
      <title>🐳 Docker Bind Mounts vs Volumes: What's the Difference?</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Sun, 04 May 2025 13:33:28 +0000</pubDate>
      <link>https://dev.to/zaheetdev/docker-bind-mounts-vs-volumes-whats-the-difference-59g4</link>
      <guid>https://dev.to/zaheetdev/docker-bind-mounts-vs-volumes-whats-the-difference-59g4</guid>
      <description>&lt;h2&gt;
  
  
  🔄 Docker Volumes vs Bind Mounts — What’s the Difference?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Understand the key differences between Docker bind mounts and volumes, when to use each, and how they work under the hood.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;When working with Docker, managing &lt;strong&gt;data persistence&lt;/strong&gt; is essential. Two primary methods for sharing and persisting data with containers are:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Bind Mounts&lt;/strong&gt;&lt;br&gt;
✅ &lt;strong&gt;Volumes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Though they might appear similar, these approaches serve distinct use cases and behave differently under the hood.&lt;/p&gt;

&lt;p&gt;In this post, we’ll explore the differences between Docker &lt;strong&gt;Bind Mounts&lt;/strong&gt; and &lt;strong&gt;Volumes&lt;/strong&gt;, when to use each, and how to get started.&lt;/p&gt;




&lt;h2&gt;
  
  
  📁 What is a Volume?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;volume&lt;/strong&gt; is a &lt;strong&gt;Docker-managed&lt;/strong&gt; storage mechanism. Docker handles the data location and lifecycle, making it the preferred way to persist data—especially in &lt;strong&gt;production&lt;/strong&gt; environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Managed under &lt;code&gt;/var/lib/docker/volumes/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Decouples storage from container logic&lt;/li&gt;
&lt;li&gt;Suitable for long-term persistence&lt;/li&gt;
&lt;li&gt;Supports custom drivers (e.g., NFS, cloud)&lt;/li&gt;
&lt;li&gt;Secure and portable&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📦 Create and Use a Volume
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a volume&lt;/span&gt;
docker volume create mydata

&lt;span class="c"&gt;# Run a container using the volume&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; myapp &lt;span class="nt"&gt;-v&lt;/span&gt; mydata:/usr/share/app/data nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🖇️ What is a Bind Mount?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;bind mount&lt;/strong&gt; allows you to mount a &lt;strong&gt;specific file or directory from the host system&lt;/strong&gt; into a container. You control the source path.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Uses &lt;strong&gt;absolute path&lt;/strong&gt; on host&lt;/li&gt;
&lt;li&gt;Ideal for local development and debugging&lt;/li&gt;
&lt;li&gt;Real-time updates from host to container&lt;/li&gt;
&lt;li&gt;Offers flexibility but less security&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧪 Create and Use a Bind Mount
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; devapp &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; /Users/zaheet/projects/mycode:/usr/share/app &lt;span class="se"&gt;\&lt;/span&gt;
  nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changes in &lt;code&gt;/Users/zaheet/projects/mycode&lt;/code&gt; will immediately reflect in the container.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚖️ Key Differences
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Bind Mounts&lt;/th&gt;
&lt;th&gt;Volumes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Managed by Docker&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Path specified&lt;/td&gt;
&lt;td&gt;✅ Host-defined&lt;/td&gt;
&lt;td&gt;❌ Docker-defined&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Use case&lt;/td&gt;
&lt;td&gt;Development&lt;/td&gt;
&lt;td&gt;Production, backups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;❌ Lower&lt;/td&gt;
&lt;td&gt;✅ Higher&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flexibility&lt;/td&gt;
&lt;td&gt;✅ More&lt;/td&gt;
&lt;td&gt;❌ Less&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance (Linux)&lt;/td&gt;
&lt;td&gt;⚠️ Varies&lt;/td&gt;
&lt;td&gt;✅ Optimized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backup/Restore&lt;/td&gt;
&lt;td&gt;🛑 Manual&lt;/td&gt;
&lt;td&gt;✅ Docker-supported&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🤔 When Should You Use What?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Use &lt;strong&gt;Bind Mounts&lt;/strong&gt; When:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You're in &lt;strong&gt;active development&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You need &lt;strong&gt;live-reload&lt;/strong&gt; behavior&lt;/li&gt;
&lt;li&gt;You want &lt;strong&gt;full control&lt;/strong&gt; of data paths&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Use &lt;strong&gt;Volumes&lt;/strong&gt; When:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You need to &lt;strong&gt;persist application data&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You’re running in &lt;strong&gt;production&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You want &lt;strong&gt;portability and safe backups&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧾 Named vs Anonymous Volumes
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Named Volume – Easier to manage and reuse&lt;/span&gt;
docker run &lt;span class="nt"&gt;-v&lt;/span&gt; myvolume:/data myimage

&lt;span class="c"&gt;# Anonymous Volume – Docker assigns a random name&lt;/span&gt;
docker run &lt;span class="nt"&gt;-v&lt;/span&gt; /data myimage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧹 Cleaning Up
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# List all volumes&lt;/span&gt;
docker volume &lt;span class="nb"&gt;ls&lt;/span&gt;

&lt;span class="c"&gt;# Remove a specific volume&lt;/span&gt;
docker volume &lt;span class="nb"&gt;rm &lt;/span&gt;mydata

&lt;span class="c"&gt;# Prune unused volumes&lt;/span&gt;
docker volume prune
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💬 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Understanding the difference between &lt;strong&gt;Docker Volumes&lt;/strong&gt; and &lt;strong&gt;Bind Mounts&lt;/strong&gt; can greatly improve your development and deployment workflow.&lt;/p&gt;

&lt;p&gt;🧠 Choose volumes when working with production workloads or databases.&lt;br&gt;
💻 Use bind mounts when you're developing locally and need live updates.&lt;/p&gt;




&lt;p&gt;If you found this helpful, don’t forget to 💖 react and 🗨️ comment below with your experience using Docker volumes or bind mounts!&lt;/p&gt;

&lt;p&gt;📬 &lt;a href="https://www.linkedin.com/in/zaheet-batada/" rel="noopener noreferrer"&gt;Follow me on LinkedIn&lt;/a&gt; for more DevOps and container tips.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;#docker #devops #containers #webdev #productivity #cloudcomputing&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>containers</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Containers vs Virtual Machines: What's the Difference?</title>
      <dc:creator>zaheetdev</dc:creator>
      <pubDate>Sat, 03 May 2025 18:04:32 +0000</pubDate>
      <link>https://dev.to/zaheetdev/containers-vs-virtual-machines-whats-the-difference-1fep</link>
      <guid>https://dev.to/zaheetdev/containers-vs-virtual-machines-whats-the-difference-1fep</guid>
      <description>&lt;h1&gt;
  
  
  What is a Container?
&lt;/h1&gt;

&lt;p&gt;A &lt;strong&gt;container&lt;/strong&gt; is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.&lt;/p&gt;

&lt;p&gt;A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.&lt;/p&gt;




&lt;h2&gt;
  
  
  Ok, let me make it easy!
&lt;/h2&gt;

&lt;p&gt;A container is a &lt;strong&gt;bundle of:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application&lt;/li&gt;
&lt;li&gt;Application libraries required to run your application&lt;/li&gt;
&lt;li&gt;The minimum system dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fii2plp87zhg8bbfxq304.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fii2plp87zhg8bbfxq304.png" alt="Container Layers Screenshot" width="800" height="337"&gt;&lt;/a&gt; &lt;/p&gt;




&lt;h1&gt;
  
  
  Containers vs Virtual Machines
&lt;/h1&gt;

&lt;p&gt;Containers and virtual machines are both technologies used to isolate applications and their dependencies, but they have some key differences:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Resource Utilization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt; share the host operating system kernel, making them lighter and faster than VMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VMs&lt;/strong&gt; have a full-fledged OS and hypervisor, making them more resource-intensive.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Portability
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt; are designed to be portable and can run on any system with a compatible host OS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VMs&lt;/strong&gt; are less portable as they need a compatible hypervisor.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VMs&lt;/strong&gt; provide a higher level of isolation and security as each has its own OS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt; share the host OS kernel, which provides less isolation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt; are easier to manage as they are designed to be lightweight and fast-moving.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Why Are Containers Lightweight?
&lt;/h1&gt;

&lt;p&gt;Containers are lightweight because they use &lt;strong&gt;containerization technology&lt;/strong&gt;, allowing them to share the host OS kernel while still providing isolation for the app and its dependencies.&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smaller size compared to full VMs&lt;/li&gt;
&lt;li&gt;Minimal components needed to run the app&lt;/li&gt;
&lt;li&gt;Faster startup and deployment times&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Let’s Understand This with an Example:
&lt;/h2&gt;

&lt;p&gt;Below is the screenshot of the &lt;strong&gt;official Ubuntu base image&lt;/strong&gt; used for containers.&lt;br&gt;&lt;br&gt;
It's just ~22 MB! 😮&lt;/p&gt;

&lt;p&gt;In contrast, an official Ubuntu &lt;strong&gt;VM image&lt;/strong&gt; is close to ~2.3 GB.&lt;br&gt;&lt;br&gt;
That’s &lt;strong&gt;almost 100 times larger&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpuahlhrotgqz5vc721pd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpuahlhrotgqz5vc721pd.png" alt="Ubuntu Image" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Files and Folders in Container Base Images
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/bin&lt;/code&gt;: contains binary executables (e.g., &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, &lt;code&gt;ps&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/sbin&lt;/code&gt;: contains system binaries (e.g., &lt;code&gt;init&lt;/code&gt;, &lt;code&gt;shutdown&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/etc&lt;/code&gt;: system config files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/lib&lt;/code&gt;: shared libraries used by binaries&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr&lt;/code&gt;: user apps, libraries, docs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/var&lt;/code&gt;: logs, spool, temp data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/root&lt;/code&gt;: home directory of root user&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Files and Folders Containers Use from Host OS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Host file system&lt;/strong&gt; via bind mounts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Networking stack&lt;/strong&gt; to connect containers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System calls&lt;/strong&gt; handled by host kernel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Namespaces&lt;/strong&gt; for isolation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control groups (cgroups)&lt;/strong&gt; to limit resource usage&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Even though containers use host resources, they’re &lt;strong&gt;isolated&lt;/strong&gt; from the host and other containers.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; VM image sizes can be optimized, but for comparison, we're using the defaults.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Containers are &lt;strong&gt;smaller and more efficient&lt;/strong&gt; because they don’t bundle an entire OS.&lt;/li&gt;
&lt;li&gt;VMs are &lt;strong&gt;heavier and less portable&lt;/strong&gt;, but offer greater isolation.&lt;/li&gt;
&lt;li&gt;Containers only include what’s necessary for your app to run.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  What is Docker?
&lt;/h1&gt;

&lt;p&gt;Docker is a &lt;strong&gt;containerization platform&lt;/strong&gt; that lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build container images&lt;/li&gt;
&lt;li&gt;Run containers from those images&lt;/li&gt;
&lt;li&gt;Push/pull containers to/from registries (e.g., DockerHub, Quay.io)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In simple terms:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Containerization&lt;/strong&gt; is a concept — &lt;strong&gt;Docker&lt;/strong&gt; is the implementation.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Docker Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78o8kdaghi0b3so9ba4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78o8kdaghi0b3so9ba4p.png" alt="Docker Architecture" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above clearly shows that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker Daemon&lt;/strong&gt; is the brain of Docker.&lt;/li&gt;
&lt;li&gt;If the Docker Daemon dies… well, Docker is &lt;strong&gt;brain dead&lt;/strong&gt; 😄 (sarcasm intended).&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>docker</category>
      <category>hypervisor</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
