LoginSignup
2
1

徳丸本のDockerでの環境構築時、ADD failed: file not found in build context or excluded by .dockerignore: stat php-5.3.3.bin-.tar.gz: file does not existのエラー

Last updated at Posted at 2023-06-01

徳丸本サポートサイトからDocker用の環境構築素材をダウンロード後、そのまま、docker compose up -dを実行したところ、以下エラーメッセージが出ました。。。

ADD failed: file not found in build context or excluded by .dockerignore: stat php-5.3.3.bin-.tar.gz: file does not exist

実行環境は、MacBookAir M2です。

結論

TARGETARCHというDocker側で自動的に設定される環境変数が設定されていなかったようです。。。
apachフォルダ内のDockerfileの2行目を下記ように変更しました。

ARG TARGETARCH=arm64

私はM2チップなのでarm64です。
IntelのMacやwindows使っている方はamd64を設定すれば良いかと思います。

余談

なんでTARGETARCHに値が設定されてないか明確には分かりませんが、Docker Desktopでrosettaの設定をオンにしてたのが原因かもですね。。。
Screenshot 2023-06-01 at 23.36.08.png

参考文献

TARGETARCH以外にもDocker側で勝手に設定される環境変数が色々あるらしいです。
https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope

2
1
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
2
1