Spring Batchでバッチアプリケーションをつくり、Spring Bootのmavenプラグインを使ってdockerイメージを作る
それをGCEのContainer Optimized OS上で実行しようとしたとき次のようなエラーがでて処理が終了してしまった
"JVM DNS caching disabled in favor of link-local DNS caching " "$BPI_APPLICATION_PATH must be set " "[31;1mERROR: [0mfailed to launch: exec.d: failed to execute exec.d file at path '/layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator': exit status 1
最後の1行からmemory-calculator
が何か失敗した模様
memory-calculator
はJavaのコンテナのメモリ割り当てを自動でおこなってくれる機能
根本原因は不明だが、Spring Bootのmemory-calculator
とContainer Optimized OSの相性が悪いのかと推測し、builderを以下に差し替えてみる
pom.xml
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <image> <name>asia.gcr.io/my-app/${project.artifactId}</name> <builder>gcr.io/buildpacks/builder:v1</builder> </image> <skip>false</skip> </configuration> </plugin>
実は、上のbuilderはmemory-calculator
の機能がはいっていないみたいなので、普段なら使わないほうがよい?のだが、今回はその機能がないことが幸いしてアプリが問題なく動作させることができた
他参考
https://github.com/making/blog-handson/blob/master/memory-calculator.md