LoginSignup
30
25

More than 5 years have passed since last update.

DockerのUbuntu16.04でtimedatectl出来ないときの対処法

Last updated at Posted at 2018-01-04

問題

通常のUbuntuでは timedatectl を使ってシステムのタイムゾーンを変更できますが、
Dockerfileから使用した場合は以下のようなエラーで動作しません。

RUN timedatectl set-timezone Asia/Tokyo
 ---> Running in c1cb017f5384
Failed to create bus connection: No such file or directory

対処法

Dockerfileからシステムのタイムゾーンを変更する場合は以下のようにします。

RUN apt-get install -y tzdata && \
    ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
30
25
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
30
25