Skip to content
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

Missing locale #415

Closed
xarg opened this issue Feb 16, 2018 · 8 comments
Closed

Missing locale #415

xarg opened this issue Feb 16, 2018 · 8 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@xarg
Copy link

xarg commented Feb 16, 2018

Seems like the latest 10.2 image (maybe earlier?) does not have the locale set correctly:

pg0_1        | 2018-02-16 17:08:35.744 UTC [1] LOG:  invalid value for parameter "lc_messages": "en_US.utf8"                                                                                                                           
pg0_1        | 2018-02-16 17:08:35.744 UTC [1] LOG:  invalid value for parameter "lc_monetary": "en_US.utf8"                                                                                                                           
pg0_1        | 2018-02-16 17:08:35.745 UTC [1] LOG:  invalid value for parameter "lc_numeric": "en_US.utf8"        
pg0_1        | 2018-02-16 17:08:35.745 UTC [1] LOG:  invalid value for parameter "lc_time": "en_US.utf8"           
pg0_1        | 2018-02-16 17:08:35.745 UTC [1] FATAL:  configuration file "/var/lib/postgresql/data/10/postgresql.conf" contains errors         

When I run locale commands in the container:

# locale                                                                                                 
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                                             
LANG=en_US.utf8                                          
LANGUAGE=                                                
LC_CTYPE="en_US.utf8"                                    
LC_NUMERIC="en_US.utf8"     
LC_TIME="en_US.utf8"        
LC_COLLATE="en_US.utf8"                                                                                            
LC_MONETARY="en_US.utf8"                                                                                           
LC_MESSAGES="en_US.utf8"                                 
LC_PAPER="en_US.utf8"                                    
LC_NAME="en_US.utf8"                                     
LC_ADDRESS="en_US.utf8"                                  
LC_TELEPHONE="en_US.utf8"                                
LC_MEASUREMENT="en_US.utf8"                              
LC_IDENTIFICATION="en_US.utf8"                           
LC_ALL= 

To fix it I did this:
RUN localedef -i en_US -f UTF-8 en_US.UTF-8

Hope it helps.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Apr 25, 2018
@wglambert
Copy link

Issue looked resolved in 10.2 and latest builds that I checked.

If issue is still present then I'll re-open.

@areed
Copy link

areed commented Feb 27, 2019

I get the same issue with this Dockerfile:

FROM postgres:10.7

RUN apt-get update && apt-get upgrade -y

The localedef command documented above fixes it.

@tianon
Copy link
Member

tianon commented Feb 27, 2019

Doing apt-get upgrade in a Dockerfile is very strongly not recommended (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get):

Avoid RUN apt-get upgrade and dist-upgrade, as many of the “essential” packages from the parent images cannot upgrade inside an unprivileged container. If a package contained in the parent image is out-of-date, contact its maintainers. If you know there is a particular package, foo, that needs to be updated, use apt-get install -y foo to update automatically.

(Which doesn't mention anything about the size duplication of having essentially the same packages re-installed in a later layer.)

@henri9813
Copy link

Hello,

This problem seems to be present on image 9.6 running in Kubernetes.

STATEMENT:  CREATE DATABASE fusionauth ENCODING 'UTF-8' LC_CTYPE 'en_US.UTF-8' LC_COLLATE 'en_US.UTF-8' TEMPLATE template0
ERROR:  invalid locale name: "English_United States"
STATEMENT:  CREATE DATABASE fusionauth ENCODING 'UTF-8' LC_CTYPE 'English_United States' LC_COLLATE 'English_United States' TEMPLATE template0

Did you fixed the 9.6 image ?

Best regards

@PhilK-7
Copy link

PhilK-7 commented Oct 18, 2022

I experience the exact same issue on a fresh pull of the official image.
After editing the postgresql.conf file - I simply uncommented the line specifying the port and set it to another one - I get the aforementioned errors upon restart.

This also means, the created docker container becomes useless at this point, as it always crashes immediately. Changing back the config file to its original state does not help.

@danielb2
Copy link

I have this issue on alpinelinux and there's no localedef command that I can find. is there another way?

@wglambert
Copy link

See https://github.com/docker-library/docs/blob/master/postgres/README.md#locale-customization

Alpine-based variants starting with Postgres 15 support ICU locales

@danielb2
Copy link

danielb2 commented Dec 20, 2022

See https://github.com/docker-library/docs/blob/master/postgres/README.md#locale-customization

Alpine-based variants starting with Postgres 15 support ICU locales

oh yes you're right. I didn't need this for pg15. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

7 participants