3
2

More than 3 years have passed since last update.

【Dockerfile】tzdataの設定について

Posted at

目的

Docker上のubuntuにjupyterlabをインストールするため、docker imageを作成しようとした。

詰まった問題

Dockerfileからdocker imageを作成するため、下記のファイル(dockerfile)をコマンドで実行しようとする…

dockerfile
FROM ubuntu

RUN apt-get update
RUN apt-get install -y sudo
RUN sudo apt install -y python3-pip
RUN sudo apt install -y language-pack-ja
RUN sudo update-locale LANG=ja_JP.UTF-8
RUN sudo apt install -y nodejs npm
RUN pip3 install jupyterlab
RUN pip3 install pandas
RUN pip3 install matplotlib
RUN pip3 install sklearn

コマンドは以下の通り。

docker build -t jupyterlab:latest ./

しかし、実行途中に以下のように表示されてしまう

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      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US
Geographic area:

このとき、6と入力しEnterを押すも反応せず…
どうやらタイムゾーンを選択すると解決するようだ。

解決法

上記のdockerfileにタイムゾーンを設定する文を追加することにより解決した。(追加した文)

FROM ubuntu

RUN apt-get update
RUN apt-get install -y sudo
RUN sudo apt install -y python3-pip
RUN sudo apt install -y language-pack-ja
RUN sudo update-locale LANG=ja_JP.UTF-8
#追加した文↓
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Moscow
RUN apt-get install -y tzdata

RUN sudo apt install -y nodejs npm
RUN pip3 install jupyterlab
RUN pip3 install pandas
RUN pip3 install matplotlib
RUN pip3 install sklearn
3
2
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
3
2