Solving the “Media is Write Protected” Docker Error (Sitecore XM Cloud on Windows)

While working on a Sitecore XM Cloud container setup locally on Windows, I encountered a baffling error:


docker: Error response from daemon: FSCTL_EXTEND_VOLUME \\?\Volume{2072a458-5396-496e-9e16-805157429bf3}: The media is write protected.


The error occurred during container start-up and prevented Sitecore instances from launching correctly. It halted all local development — Docker containers wouldn't mount correctly, and no configuration changes helped.

What Didn’t Work

I tried multiple things, but none resolved the issue:

  • Restarting Docker Desktop

  • Resetting Docker volumes

  • Rebuilding containers

  • Removing Docker data folder

  • Reinstalling Docker (latest version)

  • Changing permissions on mounted volumes

Nothing worked.

🔍 Root Cause

After researching, I discovered the issue was introduced in recent versions of Docker Desktop (v4.38+) on Windows. These versions had changes that caused volume mounting issues, especially on Windows filesystem-backed containers.


The Fix: Downgrade Docker Desktop

Here’s the process that finally resolved the issue:

1. Completely Uninstall Docker (via PowerShell): you can use below PS script to remove docker completely 

# Run as Administrator

# Stop Docker if running
Write-Host "Stopping Docker Desktop..."
Stop-Process -Name "Docker Desktop" -Force -ErrorAction SilentlyContinue
Stop-Service -Name "com.docker.service" -Force -ErrorAction SilentlyContinue

# Uninstall Docker Desktop via Win32_Product (may take a few seconds)
Write-Host "Uninstalling Docker Desktop..."
Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "Docker*" } | ForEach-Object { $_.Uninstall() }

# Remove Docker folders
$pathsToRemove = @(
    "$env:ProgramData\Docker",
    "$env:ProgramData\DockerDesktop",
    "$env:LOCALAPPDATA\Docker",
    "$env:APPDATA\Docker",
    "$env:USERPROFILE\.docker"
)

foreach ($path in $pathsToRemove) {
    if (Test-Path $path) {
        Write-Host "Removing $path..."
        Remove-Item -Path $path -Recurse -Force -ErrorAction SilentlyContinue
    }
}

# Optional: Remove Docker networking leftovers (HNS networks)
Write-Host "Cleaning up HNS Networks..."
Get-HNSNetwork | Remove-HNSNetwork -ErrorAction SilentlyContinue

# Optional: Remove Docker's Windows Firewall rules
Write-Host "Removing Docker-related firewall rules..."
Get-NetFirewallRule | Where-Object { $_.DisplayName -like "*Docker*" } | Remove-NetFirewallRule -ErrorAction SilentlyContinue

Write-Host "Docker Desktop and all related data have been removed."


2. Download & Install Docker Desktop v4.37.1

  • Get the stable v4.37.1 release from Docker’s Release Notes

  • Install it and restart your machine

After this, all Sitecore containers came up successfully — no more “media is write protected” errors!


🧠 Takeaways

  • This was not a Sitecore CLI or container configuration issue — it was entirely related to Docker Desktop engine compatibility.

  • New Docker versions can sometimes break container mounts on Windows (NTFS).

  • Always keep a list of known-working versions for stable environments (especially with complex setups like Sitecore + Docker).



 


Comments

Popular posts from this blog

Resolved: Docker Not Starting with WSL2 - Here's the Fix

Deleting solr documents from Solr Admin