2

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
1
  • It seems to be a version-related issue. My local docker and docker compose versions are likely too old for the configuration file. Commented Jun 1 at 18:03

1 Answer 1

0

This issue is resolved after upgrading my local Docker and Docker Compose from 19.03 and 1.21 to 28.2.2 and v2.36.2, respectively. The old versions come with Debian Bullseye as the default. I have to override the default versions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.