Fixing Docker GitLab CI Errors with System Cleanup

Posted on Mar 13, 2025

Fixing Docker GitLab CI Errors with System Cleanup

Running GitLab CI on Unraid with Docker can occasionally result in filesystem corruption errors that break your builds. Here’s a quick fix for those frustrating “no such file or directory” errors.

The Problem

GitLab CI builds failing with errors like:

Error response from daemon: open /var/lib/docker/btrfs/subvolumes/mqfn3uze3zvt9kkzl0vhvcz25/usr/local/share/.cache/yarn/v6/npm-extglob-2.0.4-ad00fe4dc612a9232e8718711dc5cb5ab0285543-integrity/node_modules/extglob/lib/.DS_Store: no such file or directory

These errors typically indicate:

  • Corrupted Docker layers
  • Orphaned filesystem references
  • BTRFS subvolume inconsistencies on Unraid systems

The Solution

A simple Docker system cleanup resolves most of these issues:

docker system prune

This command removes:

  • Unused containers
  • Unused networks
  • Unused images
  • Build cache

Why It Works

Docker’s layered filesystem can accumulate corrupted or orphaned references over time, especially on BTRFS filesystems used by Unraid. The system prune command:

  1. Clears dangling references to missing files
  2. Removes corrupted build cache entries
  3. Forces Docker to rebuild clean filesystem layers

Prevention Tips

  • Run docker system prune regularly as maintenance
  • Monitor disk space - corruption often occurs when storage is nearly full
  • Consider using docker system prune -a for more aggressive cleanup (removes unused images too)
  • Set up automated cleanup scripts for CI environments

This simple maintenance command can save hours of debugging complex filesystem issues in containerized CI/CD environments.