※こちらは旧サイトです(新サイトはこちら

Dockerで立てたDebianコンテナの日本語環境を整えた

2015-10-13 17:20:29

オフィシャルのDebianコンテナ立てた後、何も設定されてなかったのでいろいろした

ロケールを見る

$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

日本語にしたい

$ sudo localedef -f UTF-8 -i ja_JP ja_JP
character map file `UTF-8' not found: No such file or directory
cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory

とてもエラー

$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "ja_JP.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg-query: package 'locales' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
/usr/sbin/dpkg-reconfigure: locales is not installed

必要な物を入れる

$ sudo apt-get install locales dialog

設定する

$ sudo dpkg-reconfigure locales

確認

$ df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
none             228G  2.9G  213G    2% /

日本語になった