Skip to content

Docker Compose "ERROR internal load metadata" Fix

When Docker Compose suddenly fails with "ERROR internal load metadata" during the build process, it's often related to network connectivity, authentication issues, or configuration problems. Here's a comprehensive guide to diagnosing and resolving this frustrating error.

Problem Overview

The error typically appears when Docker Compose cannot retrieve metadata from container registries like Docker Hub or Microsoft Container Registry (MCR), despite previously working configurations:

none
ERROR [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0.201-buster-slim:
failed to do request: Head https://mcr.microsoft.com/v2/dotnet/sdk/manifests/5.0.201-buster-slim: dial tcp: lookup mcr.microsoft.com on 192.168.65.5:53:

Common symptoms include:

  • Sudden failure without Dockerfile or compose file changes
  • Network connectivity issues to container registries
  • Authentication/authorization problems
  • Platform compatibility mismatches

Common Solutions

1. Network and Connectivity Issues

INFO

First, verify your internet connection and DNS resolution:

bash
# Test connectivity to container registry
ping mcr.microsoft.com

# Try pulling the image directly
docker pull mcr.microsoft.com/dotnet/sdk:5.0.201-buster-slim

DNS Resolution

If DNS resolution fails, try switching to public DNS servers like Google (8.8.8.8) or Cloudflare (1.1.1.1)

2. Authentication Problems

Docker credential issues are a common cause:

bash
# Re-authenticate with Docker Hub
docker login

# Check current authentication status
docker info | grep Username

For credential store issues, edit your Docker configuration:

bash
# Location: ~/.docker/config.json
vi ~/.docker/config.json
bash
# Location: C:\Users\<username>\.docker\config.json
notepad C:\Users\<username>\.docker\config.json

Try these fixes in your config.json:

json
// Change "credsStore" to "credStore" (note the missing 's')
{
  "auths": {
    "https://index.docker.io/v1/": {}
  },
  "credStore": "desktop"  // Was "credsStore"
}

WARNING

If authentication issues persist, remove and regenerate the config file:

bash
# Backup and remove config
mv ~/.docker/config.json ~/.docker/config.json.backup

# Or remove the entire .docker directory (more drastic)
rm -rf ~/.docker

After removal, run docker login to regenerate proper credentials.

3. Platform Compatibility Issues

ARM64/AMD64 architecture mismatches can cause metadata loading failures:

bash
# Explicitly specify platform during build
docker build --platform=linux/amd64 -t your-image:tag .

# Check your system architecture
arch  # or uname -m on Linux/Mac

For Apple Silicon (M1/M2) users, many images may not have arm64 versions available.

4. Docker Configuration and Cache Issues

Corrupted cache or configuration can cause this error:

bash
# Clear Docker system resources
docker system prune -a

# Restart Docker service
sudo systemctl restart docker  # Linux
# Or restart Docker Desktop on Windows/Mac

5. Disk Space and Resource Issues

Insufficient disk space can prevent Docker from operating correctly:

bash
# Check available disk space
df -h  # Linux/Mac
# or check Docker Desktop disk usage
bash
# Clean up unused resources
docker system df  # Show usage
docker system prune -a --volumes  # Remove all unused resources

6. VPN and Proxy Configuration

Corporate networks, VPNs, or proxy settings can interfere:

bash
# Check Docker proxy settings
docker info | grep -i proxy

# Temporary solution: disable VPN/proxy

For Docker Desktop, check:

  • Settings → Resources → PROXIES
  • Settings → Docker Engine for manual proxy configuration

7. Docker BuildKit Issues

Temporarily disable BuildKit to isolate the issue:

json
// In Docker Desktop settings → Docker Engine
{
  "features": {
    "buildkit": false
  }
}

After applying, restart Docker and try building again.

Advanced Troubleshooting

Check Docker Logs

bash
# View Docker daemon logs
journalctl -u docker.service  # Systemd Linux

Verify Dockerfile Syntax

Ensure multi-stage build labels are correct:

dockerfile
# Correct labeling for multi-stage builds
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base  # Not 'build'

WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0.201-buster-slim AS build  # Correct

WORKDIR /app
# ... build steps ...

Registry-Specific Issues

For Microsoft Container Registry issues specifically:

bash
# Test MCR connectivity
curl -I https://mcr.microsoft.com/v2/

# Check MCR status page (no official status page, but check Azure status)

Prevention Strategies

  1. Pin specific image versions instead of using tags like latest
  2. Use local registry mirrors for enterprise environments
  3. Maintain adequate disk space with regular cleanup schedules
  4. Monitor Docker updates that might change authentication behavior
  5. Use infrastructure-as-code to ensure consistent environments

When All Else Fails

If none of the above solutions work, consider these nuclear options:

bash
# Complete Docker reset (warning: removes all containers and images)
docker system prune -a --volumes
rm -rf ~/.docker

# Reinstall Docker Desktop
# Check for host system updates
# Reboot your machine

Data Loss Warning

These actions will remove all Docker containers, images, and volumes. Back up important data first.

Conclusion

The "ERROR internal load metadata" in Docker Compose typically stems from connectivity, authentication, or configuration issues. Start with basic network checks, then progress through credential verification, platform compatibility, and system resource checks. For most users, the credential store fix (credsStorecredStore) or simple Docker restart resolves the issue.

Remember that Docker and container registry services occasionally experience outages, so sometimes the solution is simply waiting for service restoration.