Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      A Breeze Of Inspiration In September (2025 Wallpapers Edition)

      August 31, 2025

      10 Top Generative AI Development Companies for Enterprise Node.js Projects

      August 30, 2025

      Prompting Is A Design Act: How To Brief, Guide And Iterate With AI

      August 29, 2025

      Best React.js Development Services in 2025: Features, Benefits & What to Look For

      August 29, 2025

      Report: Samsung’s tri-fold phone, XR headset, and AI smart glasses to be revealed at Sep 29 Unpacked event

      September 1, 2025

      Are smart glasses with built-in hearing aids viable? My verdict after months of testing

      September 1, 2025

      These 7 smart plug hacks that saved me time, money, and energy (and how I set them up)

      September 1, 2025

      Amazon will sell you the iPhone 16 Pro for $250 off right now – how the deal works

      September 1, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Fake News Detection using Python Machine Learning (ML)

      September 1, 2025
      Recent

      Fake News Detection using Python Machine Learning (ML)

      September 1, 2025

      Common FP – A New JS Utility Lib

      August 31, 2025

      Call for Speakers – JS Conf Armenia 2025

      August 30, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Chrome on Windows 11 FINALLY Gets Touch Drag and Drop, Matching Native Apps

      August 31, 2025
      Recent

      Chrome on Windows 11 FINALLY Gets Touch Drag and Drop, Matching Native Apps

      August 31, 2025

      Fox Sports not Working: 7 Quick Fixes to Stream Again

      August 31, 2025

      Capital One Zelle not Working: 7 Fast Fixes

      August 31, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Reclaim Space: Delete Docker Orphan Layers

    Reclaim Space: Delete Docker Orphan Layers

    July 18, 2025

    If you’re using Sitecore Docker containers on Windows, you’ve probably noticed your disk space mysteriously shrinking over time. I recently encountered this issue myself and was surprised to discover the culprit: orphaned Docker layers – leftover chunks of data that no longer belong to any container or image.

    My Setup

    This happened while I was working with Sitecore XP 10.2 in a Dockerized environment. After several rounds of running’ docker-compose up’ and rebuilding custom images, Docker started hoarding storage, and the usual’ docker system prune’ didn’t fully resolve the issue.

    That’s when I stumbled upon a great blog post by Vikrant Punwatkar: Regain disk space occupied by Docker

    Inspired by his approach, I automated the cleanup process with PowerShell, and it worked like a charm. Let me walk you through it.

    So, What Are Orphan Docker Layers?

    Docker uses layers to build and manage images. Over time, when images are rebuilt or containers removed, some layers are left behind. These “orphan” layers hang around in your system, specifically under:

    C:ProgramDataDockerwindowsfilter

    They’re not in use, but they still consume gigabytes of space. If you’re working with large containers, such as Sitecore’s, these can add up quickly.

    Step-by-Step Cleanup with PowerShell

    I broke the cleanup process into two simple scripts:

    1. Identify and optionally rename orphan layers
    2. Delete the renamed layers after fixing permissions

    Script 1: Find-OrphanDockerLayers.ps1

    This script compares the layers used by active images and containers against what’s actually on your disk. Anything extra is flagged as an orphan. You can choose to rename those orphan folders (we add -removing at the end) for safe deletion.

    What it does

    • Scans the image and container layers
    • Compared with the actual Docker filesystem folders
    • Identifies unused (orphan) layers
    • Calculates their size
    • Renames them safely (optional)

    A. Download PowerShell script and execute (as Administrator) with the parameter -RenameOrphanLayers

    B. To Run:

    .Find-OrphanDockerLayers.ps1 -RenameOrphanLayers

    C. Sample Output:

    WARNING: YOUR-PC - Found orphan layer: C:ProgramDataDockerwindowsfilterabc123 with size: 500 MB
    ...
    YOUR-PC - Layers on disk: 130
    YOUR-PC - Image layers: 90
    YOUR-PC - Container layers: 15
    WARNING: YOUR-PC - Found 25 orphan layers with total size 4.8 GB
    
    

    This provides a clear picture of the space you can recover.

    Delete After Stopping Docker

    Stop Docker completely first using the below PowerShell command, or you can manually stop the Docker services:

    Stop-Service docker

    Script 2: Delete-OrphanDockerLayers.ps1

    Once you’ve renamed the orphan layers, this second script deletes them safely. It first fixes folder permissions using takeown and icacls, which are crucial for system directories like these.

    A. Download the PowerShell script and execute (as Administrator)

    B. To Run:

    .Delete-OrphanDockerLayers.ps1

    C. Sample Output:

    Fixing permissions and deleting: C:ProgramDataDockerwindowsfilterabc123-removing
    ...
    

    Simple and effective — no manual folder browsing or permission headaches.

    End Result: A Cleaner, Lighter Docker

    After running these scripts, I was able to recover multiple gigabytes of storage, and you’ll definitely benefit from this cleanup. If you’re frequently working with:

    • Sitecore custom Docker images
    • Containerized development setups
    • Large volume-mounted projects

    Pro Tips

    • Run PowerShell as Administrator – especially for the delete script.
    • Don’t delete folders manually – rename first to ensure safety.
    • Use -RenameOrphanLayers only when you’re ready to clean up. Otherwise, run the script without it for a dry run.
    • Consider scheduling this monthly if you’re actively building and tearing down containers.

    Credit Where It’s Due

    Huge thanks to Vikrant Punwatkar for the original idea and guidance. His blog post was the foundation for this automated approach.

    Check out his post here: Regain disk space occupied by Docker

    Final Thoughts

    If your Docker setup is bloated and space is mysteriously disappearing, try this approach. It’s quick, safe, and makes a noticeable difference – especially on Windows, where Docker’s cleanup isn’t always as aggressive as we’d like.

    Have you tried it? Got a different solution? Feel free to share your thoughts or suggestions for improvement.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleTop 10 Threat Intelligence Platforms in ANZ: 2025 Guide for Security Teams
    Next Article Model predicts long-term effects of nuclear waste on underground disposal systems

    Related Posts

    Artificial Intelligence

    Scaling Up Reinforcement Learning for Traffic Smoothing: A 100-AV Highway Deployment

    September 1, 2025
    Repurposing Protein Folding Models for Generation with Latent Diffusion
    Artificial Intelligence

    Repurposing Protein Folding Models for Generation with Latent Diffusion

    September 1, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-52819 – Pakkemx Pakke Envíos SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Optimize RAG in production environments using Amazon SageMaker JumpStart and Amazon OpenSearch Service

    Machine Learning

    CVE-2025-6218: WinRAR Directory Traversal Bug Opens the Door to Remote Code Execution

    Security

    Implementing An Airbnb and Excel MCP Server

    Machine Learning

    Highlights

    CVE-2024-6198 – “TP-Link Modem Lighttpd SNORE Stack Buffer Overflow Vulnerability”

    April 25, 2025

    CVE ID : CVE-2024-6198

    Published : April 25, 2025, 1:15 p.m. | 1 hour, 46 minutes ago

    Description : The device exposes a web interface on ports TCP/3030 and TCP/9882. This web service runs lighttpd, which implements the “SNORE” interface. This interface is affected by a stack buffer overflow vulnerability due to insecure path parsing. An attacker
    with access to the LAN network interface could use a specially crafted HTTP request to exploit a buffer overflow on the modem.

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    Carnegie Mellon University at ICLR 2025

    April 23, 2025

    Microsoft’s CEO says AI has written 20% to 30% of the company’s code

    April 30, 2025

    CVE-2025-53610 – Cisco WebEx Meeting Server Unvalidated Redirect

    July 8, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.