I am familiar with postgres:16-alpine
. With the following compose.yaml
and connectionstring postgres://postgres:postgres@db:5432/postgres
it works:
services:
server:
container_name: configurator-server
build:
context: .
target: development
volumes:
- .:/app
- gomodcache:/go/pkg/mod
ports:
- 50031:8080
- 50032:12345
env_file: .env
depends_on:
- db
networks:
- myNetwork
- default
db:
container_name: configurator-db
image: kartoza/postgis:16-3.4
environment:
POSTGRES_PASSWORD: postgres
PGUSER: postgres
ports:
- 50033:5432
volumes:
- ./initdb:/docker-entrypoint-initdb.d
- dbdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 1s
timeout: 10s
retries: 10
adminer:
container_name: configurator-adminer
image: adminer:latest
restart: always
ports:
- 50034:8080
volumes:
gomodcache: null
dbdata: null
networks:
myNetwork:
name: MyNetwork
Now I am trying to add kartoza/postgis:16-3.4
to my project, updated compose.yaml
with following values:
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_raster
When run, in the log i see:
postgres ready
configurator-db | Creating user postgres
configurator-db | [Entrypoint] Creating/Updating user postgres
configurator-db | 2024-06-05 12:34:51.746 UTC [220] root@root FATAL: role "root" does not exist
configurator-db | ALTER ROLE
configurator-db | Creating user replicator
configurator-db | [Entrypoint] Creating/Updating user replicator
configurator-db | CREATE ROLE
configurator-db | [Entrypoint] Database postgres already exists
and it prints root@root FATAL: role "root" does not exist
every second.
What’s wrong? I am working on WSL2 Windows 11.