20
13

More than 3 years have passed since last update.

[備忘録]Docker for windowsで急にビルドできなくなった。

Last updated at Posted at 2020-12-25

ビルドできない

いつも通り、Docker for windowsでDockerfileを使ってUbuntuを使おうと思ったら、
エラーが出てビルドできなかった。
調べるが、あまり出で来なかったので、備忘録として残しておきます。
大雑把な環境は以下の通りです。
・Windows 10 pro
・WSL2 (ubuntu18.04)
・Docker for windows

ビルド

docker build -f ./Dockerfile -t test .

エラー


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 [::1]:53: read udp [::1]:37977->[::1]:53: read: connection refused

解決

Docker for windowsを開き、
設定のDocker Engineの中を以下のように変更し、dockerをrestartしたら治りました。

変更前
{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": false,
  "features": {
    "buildkit": true
  }
}
変更後
{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": false
}

参考にした記事は、こちらです。

20
13
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
13