=> ERROR [internal] load metadata for docker.io
[+] Building 0.4s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.71kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/ubuntu:22.04 0.2s
------
> [internal] load metadata for docker.io/library/ubuntu:22.04:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io": dial tcp: lookup auth.docker.io on xxx.xxx.x.x:xx: no such host
解決方案:
- 修改設定檔 daemon.json,將"buildkit": true設定成"buildkit": false
預設 { "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": false, "features": { "buildkit": true } } 修改後 { "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": false, "features": { "buildkit": false } }
2.如果有安裝Docker Desktop 如圖修改,完成後按下"Apply & Restart".