Running Percona Distribution for PostgreSQL 16.2 and pgAdmin using Docker compose

Hi, I’m starting to learn PG, and today, I tried an installation using Docker.

As I understand it, PostgreSQL defaults to SQL_ASCII encoding rather than UTF-8, for historical reasons.

This caused an error when creating a new database in pgAdmin, I had to select Template (template0) to avoid the error.

I figured I could probably initiate Postgres with default UTF-8

For this purpose I added the parameter LANG: en_US.utf8 .

Now everything works fine, but maybe there are some problems in the future?

My working configuration.

version: '3'
services:
  postgres:
    image: percona/percona-distribution-postgresql:16.2-multi
    environment:
      POSTGRES_PASSWORD: mysecretpassword
      POSTGRES_USER: myuser
      LANG: en_US.utf8
    volumes:
      - postgres:/var/lib/postgresql/data

  pgadmin:
    image: dpage/pgadmin4:8
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@pgadmin.com
      PGADMIN_DEFAULT_PASSWORD: mypgadminpassword
      PGADMIN_LISTEN_PORT: 80
    ports:
      - 15432:80
    volumes:
      - pgadmin:/var/lib/pgadmin
    depends_on:
      - postgres

volumes:
  postgres:
  pgadmin:

Hi,

For the sake of simplicity I’m going to suggest a completely different way of learning to work with PostgreSQL in a docker environment. Refer to the SPILO project which is on github. Although this is more complex that your original posting, it is easier to install and run. And it will also introduce you to the services required to make a postgres replication cluster highly available.

Hope this helps.

1 Like