LoginSignup
0
0

More than 3 years have passed since last update.

Docker build時にargの指定忘れに気付きたい

Last updated at Posted at 2020-12-13

今日も今日とてDocker buildでargを指定し忘れる。
しかも基底のDockerイメージだから複数のコンテナイメージをbuildをやりなおさなきゃ。。

そんな、私と同じ経験をしている方へ。
Docker buildするときにエラーになるようにしましょう。

■方法 Dockerfile
ARG MY_VARIABLE
RUN test -n "$MY_VARIABLE" ← このようにMY_VARIABLEの長さが0ならコマンド失敗するようにする。

■備考
無駄なレイヤが増えちゃいます
できればDockerのビルドで公式にエラーにできるオプションが欲しい。

■参考
https://stackoverflow.com/questions/38438933/how-to-make-a-build-arg-mandatory-during-docker-build
https://www.atmarkit.co.jp/ait/articles/1807/05/news041.html

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