I'm using a JHipster 8.11.0-generated app with PostgreSQL as the database. To run the app in Docker, I execute the command:
docker-compose -f src/main/docker/postgresql.yml up
as per the JHipster documentation. However, I encounter the following error:
ERROR: In file './src/main/docker/postgresql.yml', service 'name' must be a mapping, not a string.
To fix this, I commented out:
name: myapp
and added:
version: '3.3'
After these changes, I get two new errors:
could not execute command "/usr/lib/postgresql/17/bin/postgres -V": Cannot allocate memory
postgresql_1 | initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/17/bin/initdb"
Because Docker isn't up, I am unable to access it to find out its memory or the postgres location.
I'm unsure if the PostgreSQL version is too new or if there's another issue. Has anyone encountered these errors? How can I resolve them?
For reference, here is the postgresql.yml after the editing:
# name: myapp
version: '3.3'
services:
postgresql:
image: postgres:17.4
# volumes:
# - ~/volumes/jhipster/myaoo/postgresql/:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=myapp
- POSTGRES_HOST_AUTH_METHOD=trust
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U $${POSTGRES_USER}']
interval: 5s
timeout: 5s
retries: 10
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:5432:5432