Docker error – failed to register layer: cannot create layer with missing parent

Challenge:

Recently I got my docker updated to the latest version i.e. I uninstalled and installed the latest docker. I started getting the below error upon docker compose.

failed to register layer: cannot create layer with missing parent id  CreateFile C:\ProgramData\Docker\windowsfilter\Id: The system cannot find the file specified.

Solution:

Here are the steps that worked for me.

  1. Uninstall Docker.
  2. Restart the system.
  3. Delete these folders - C:\ProgramData\Docker and C:\ProgramData\DockerDesktop. It won't be able to delete a folder from C:\ProgramData\Docker\windowsfilter. Rest continue to delete and complete it.
  4. Install Docker.
  5. Start Docker and go to Troubleshoot window.
  1. Click "Clean / Purge data".
  1. Select all the options and delete. Let it continue as it take time to delete. Note Do not click on the grey area else this window will go away. Not sure if it still runs in the background.
  1. Close once below window is shown. Restart the system.

This is the key step as it also deletes the remaining files from C:\ProgramData\Docker\windowsfilter which we were not able to delete.

Run the docker commands to build and run the containers. It worked!

Hope this helps.

Happy Docker troubleshooting! 🙂