2
1

More than 1 year has passed since last update.

【Docker】タイムゾーンの設定でbuildが止まった時の対処法

Posted at

Dockerでbuildを実行した際に、タイムゾーンの設定でbuildが止まってしまったので対処法をメモしておく。

問題

Dockerでbuildした際に、以下のようなタイムゾーンの選択を求められて、buildが止まってしまった。
この画面で、タームゾーンを選択しても止まったままの状態になってしまう。

コンソール
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

1. Africa 6. Asia 11. System V timezones
2. America 7. Atlantic Ocean 12. US
3. Antarctica 8. Europe 13. None of the above
4. Australia 9. Indian Ocean
5. Arctic Ocean 10. Pacific Ocean
Geographic area:

解決策

解決策としては、Dockerfileに以下の記述を追加した。

Dockerfile
ENV DEBIAN_FRONTEND=noninteractive
# timezoneを設定
ENV TZ=Asia/Tokyo

追加するとタームゾーンの選択でbuildが止まることはなくなった。
ちなみに、タイムゾーンの設定が正常に行われているかチャックしてみると、正しくJST(日本)になっていた。

コンソール
$ docker run -it <イメージID>
root@<コンテナID>:<WORKDIR># date
Tue Mar  8 15:33:51 JST 2022
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