【Bug 解决】Error:failed to solve failed to do request:Head “https://registry-1.docker.io/v2/library/xxx

Problem Description

ERROR: failed to solve failed to do request: Head “https://registry-1.docker.io/v2/library/nginx/manifests/1.19.7”: EOF

Cause

  • Replaced the mirror warehouse with a domestic mirror source;
  • Modify the configuration of docker engine;

Post my modified configuration here. Two changes have been made. The source address of the domestic mirror image has been added registry-mirrorsand buildkitchanged to false. The configuration file path is~.docker/daemon.json

{
    
    
 "registry-mirrors": [ 
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn/"
  ],
  "builder": {
    
    
    "gc": {
    
    
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    
    
    "buildkit": false
  }
}

Solution
Use docker systemthe series of commands to clear the image cache. In general, the operation and maintenance cleans up the image by docker rm ideleting the image through the command. But this command will not delete docker buildthe cache files generated by the command.

Check the cache first, docker system df
insert image description here
execute the command, and clear the cache in depth

docker system prune -a --force

Corresponding to -a deletes all unused images, -f or --force deletes them forcefully without confirmation.

Guess you like

Origin blog.csdn.net/haoaiqian/article/details/131156741