Skip to content

Multiple arguments in POSTGRES_INITDB_ARGS #622

@hatifnatt

Description

@hatifnatt

I want to pass multiple arguments to initdb but looks like that's not working.

docker-compose.yml

version: '3.1'

services:
  db:
    build: .
    restart: always
    environment:
      POSTGRES_PASSWORD: mypass
      POSTGRES_INITDB_ARGS="--data-checksums --locale=ru_RU.UTF-8"

Dockerfile, required to add ru_RU.UTF-8 locale to image

FROM postgres:12
RUN localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8

Error:

db_1  | initdb: unrecognized option '--data-checksums --locale=ru_RU.UTF-8'

If I set POSTGRES_INITDB_ARGS to --data-checksums or to --locale=ru_RU.UTF-8 it's working fine.

That seems odd because if I test corresponding line from docker-entrypoint.sh it working fine

Code below is simply executed in bash console

POSTGRES_INITDB_ARGS="--data-checksums --locale=ru_RU.UTF-8"
eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"

Output

The files belonging to this database system will be owned by user "hatifnatt".
This user must also own the server process.

The database cluster will be initialized with locale "ru_RU.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "russian".

Data page checksums are enabled.
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions