0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Windows 環境での docker-compose ビルドの際、Dockerfile の読込に失敗する

Posted at

結構ハマったが、エラーメッセージでヒットするページが無かったので残しておく。

環境

  • Windows10 Pro 64bit

エラー内容

例として docker-compose.yml 及び Dockerfile は最低限の内容。

docker-compose.yml
version: '3'
services:
  app:
    build: ./Dockerfile
Dockerfile
FROM php:7.4-apache
C:\dev\tutorial-docker>docker-compose up -d
Creating network "tutorial-docker_default" with the default driver
Building app
[+] Building 0.1s (1/2)
 => ERROR [internal] load build definition from Dockerfile                                                         0.0s
 => => transferring dockerfile: 90B                                                                                0.0s
------
 > [internal] load build definition from Dockerfile:
------
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: walk \\?\C:\dev\tutorial-docker\Dockerfile: The system cannot find the path specified.
ERROR: Service 'app' failed to build : Build failed

解決

以下のように docker-compose.yml を修正する。

docker-compose.yml
version: '3'
services:
  app:
    build:
      context: .
      dockerfile: ./Dockerfile
C:\dev\tutorial-docker>docker-compose up -d
Building app
[+] Building 0.4s (5/5) FINISHED
~
Creating tutorial-docker_app_1 ... done

正常にビルドされた。

参考

https://qiita.com/sam8helloworld/items/e7fffa9afc82aea68a7a

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?