ビルド時の話
Dockerfileを書く際に極力USERやRUN構文を減らして、ワンライナーで書くことが多い。Dockerに食わせる際にステップ数が増えると実行処理に掛かる時間が長くなるから、というのが理由。
で、そんな書き方をしているとたまに下記の様なエラーに遭遇する。
1 2 3 4 |
[WARNING]: Empty continuation line found in: RUN set -x && 省略 [WARNING]: Empty continuation lines will become errors in a future release. |
RUN order部分のワンライナーでゴチャゴチャ書いている部分には、空行は特に設定されていない。しかし空行判定となってWarningが出るらしい。(Warningというよりもエラー内容的にDeprecationエラーっぽいような気がする。)
内容的にDeprecationなので、このまま実行してしまっても問題なくビルドできる。
原因と対策
問題が生じるときには大体原因はコードにある。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
RUN set -x \ && apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests \ lib32stdc++6 \ lib32gcc1 \ wget \ ca-certificates \ && useradd -m steam \ && su steam -c \ "mkdir -p /home/steam/steamcmd \ && cd /home/steam/steamcmd \ && wget -qO- 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar zxf -" \ && apt-get clean autoclean \ && apt-get autoremove -y \ && rm -rf /var/lib/{apt,dpkg,cache,log}/ \ # installation for 7dtd server, app id is set on "294420" && su steam -c \ "./home/steam/steamcmd/steamcmd.sh \ +login anonymous \ +force_install_dir /home/steam/7dtd \ +app_update 294420 validate \ +quit" \ # reconfiguring permission for data/save directory, configuration files. && mkdir -p $SAVEDIR \ && mkdir -p $DATADIR \ && chmod 777 $SAVEDIR \ && chmod 777 $DATADIR |
L16/23に実行時の動作についてコメントを入れているが、これを外すとエラーが発生しなくなった。
False positive “Empty continuation lines will become errors in a future release.” · Issue #35387 · moby/moby · GitHub
version 17.10でコメントに関しては空行としてカウントされない様に修正が加えられているらしい。また今後order上での空行については、エラー文通りDeprecationなので削除される=空行が存在するとビルドできない様になりそう。