Skip to content

Support of languages and fix #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

Tedezed
Copy link

@Tedezed Tedezed commented Dec 13, 2017

Hi!

I need to be able to change the language of the database. Can this be a good change?

Default mode

docker run -e POSTGRES_USER=example -e POSTGRES_PASSWORD=pass tedezed/postgres:9.6

postgres=# SHOW LC_COLLATE;
 lc_collate 
------------
 en_US.utf8

Change language

docker run -e POSTGRES_USER=exaple -e POSTGRES_PASSWORD=pass -e LANG="ja_JP.utf8" -e LANGUAGE="ja_JP" tedezed/postgres:9.6

postgres=# SHOW LC_COLLATE;
 lc_collate 
------------
 ja_JP.utf8
(1 fila)

Log:

データベースシステム内のファイルの所有者は"postgres"ユーザでした。
このユーザがサーバプロセスを所有しなければなりません。

データベースクラスタはロケール"ja_JP.utf8"で初期化されます。
したがってデフォルトのデータベース符号化方式はUTF8に設定されました。
initdb: ロケール"ja_JP.utf8"用の適切なテキスト検索設定が見つかりません
デフォルトのテキスト検索設定はsimpleに設定されました。

データベージのチェックサムは無効です。

ディレクトリ/var/lib/postgresql/dataの権限を設定しています ... ok
サブディレクトリを作成しています ... ok
デフォルトのmax_connectionsを選択しています ... 100
デフォルトの shared_buffers を選択しています ... 128MB
selecting dynamic shared memory implementation ... posix
設定ファイルを作成しています ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
データをディスクに同期しています...ok

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start


警告: ローカル接続向けに"trust"認証が有効です。
pg_hba.confを編集する、もしくは、次回initdbを実行する時に-Aオプショ
ン、または、--auth-localおよび--auth-hostを使用することで変更するこ
とができます。
サーバの起動完了を待っています....LOG:  IPv6ソケットをバインドできませんでした: 要求アドレスに割り当てられません
ヒント:  すでに他にpostmasterがポート5432で稼動していませんか? 稼動していなければ数秒待ってから再実行してください
LOG:  データベースシステムは 2017-12-13 14:50:34 UTC にシャットダウンしました
LOG:  MultiXact member wraparound protections are now enabled
LOG:  データベースシステムの接続受付準備が整いました。
LOG:  自動バキュームランチャプロセス
完了
サーバ起動完了
CREATE DATABASE

CREATE ROLE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

LOG:  高速シャットダウン要求を受け取りました
LOG:  活動中の全トランザクションをアボートしています
LOG:  自動バキュームランチャを停止しています
サーバ停止処理の完了を待っています....LOG:  シャットダウンしています
LOG:  データベースシステムはシャットダウンしました
完了
サーバは停止しました

PostgreSQL init process complete; ready for start up.

LOG:  データベースシステムは 2017-12-13 14:50:36 UTC にシャットダウンしました
LOG:  MultiXact member wraparound protections are now enabled
LOG:  データベースシステムの接続受付準備が整いました。
LOG:  自動バキュームランチャプロセス

Greetings and many thanks.

@Tedezed Tedezed changed the title Support to be able to change the language of the database Support of languages and fix Dec 13, 2017
@tianon
Copy link
Member

tianon commented Dec 13, 2017

How to do this is already included in the documentation: (https://hub.docker.com/_/postgres/; https://github.com/docker-library/docs/blob/30d6d9cea70b3e36f44e76d55f24f43fc6c702c3/postgres/README.md#how-to-extend-this-image)

You can also extend the image with a simple Dockerfile to set a different locale. The following example will set the default locale to de_DE.utf8:

FROM postgres:9.4
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
ENV LANG de_DE.utf8

Since database initialization only happens on container startup, this allows us to set the language before it is created.

@Tedezed
Copy link
Author

Tedezed commented Dec 14, 2017

I know that solution but I think the idea be good to congratulate the process even more.
I close then, regards!

@Tedezed Tedezed closed this Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants