以下の内容はhttps://blog.naichilab.com/entry/2023/01/02/030654より取得しました。


docker build で [internal] load build definition from Dockerfile というエラーが出る

症状

Dockerfileがあるフォルダでdocker buildを実行してみたら下記エラー

docker build -t naichilab/unityroom-openstack-swift:0.0.1 Dockerfile
[+] Building 0.0s (1/2)                                                                  
 => ERROR [internal] load build definition from Dockerfile                          0.0s
 => => transferring dockerfile: 36B                                                 0.0s
------
 > [internal] load build definition from Dockerfile:
------
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: walk Dockerfile: not a directory

原因

docker build --help

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --iidfile string          Write the image ID to the file
つづく

PATHはファイル名ではなくDockerfileがある場所へのパスだった。

対応

コマンドを以下のように変更したら問題なくビルドできた

docker build -t naichilab/unityroom-openstack-swift:0.0.1 .



以上の内容はhttps://blog.naichilab.com/entry/2023/01/02/030654より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14