How to set locale in postgres using docker-compose?

I've tried multiple ways of changing the locale to en_GB and nothing seems to work.

My current docker-compose.yml

version: '3.9'

services:

  db:
    image: postgres
    restart: always
    build: 
      context: .
      dockerfile: ./Dockerfile
    ports:
      - 5432:5432
    volumes:
      - ./pg-data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
      PGDATA: ${PGDATA}
      # LANG: 'en_GB.UTF-8'

  adminer:
    depends_on: 
      - db
    image: adminer
    restart: always
    ports:
      - 8080:8080
  
volumes:
  pg-data:

An official postgres image docs says to create a Dockerfile with:

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

However this has no effect whatsoever.. Tried setting enviorment variable LC_* and LANG however this throws build error of enviorment variables being configured wrong.

Having just a Dockerfile without the enviorment variables set container builds and db is being reinitialized but while running first migration with knex the table consisting money type is still in dollars.



from Recent Questions - Stack Overflow https://ift.tt/3kCHtZN
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation