I am running docker-compose in Github-Action. docker-compose.yml has following service definition for postgres
  postgres:
    container_name: postgres
    image: postgres:12
    restart: always
    volumes:
      - ./test/data/init.sql:/docker-entrypoint-initdb.d/init.sql
    environment:
      POSTGRES_DB: "pgdb"
      POSTGRES_USER: "pguser"
      POSTGRES_PASSWORD: "fr2Yitl4BgX"
    ports:
      - "${POSTGRES_PORT:-5432}:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready" ]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - "local-api"
But when container start on serf-hosted Github-Action runner, I see following
postgres    | 2021-12-02 19:48:33.537 UTC [414] FATAL:  role "root" does not exist
postgres    | 2021-12-02 19:48:43.984 UTC [424] FATAL:  role "root" does not exist
postgres    | 2021-12-02 19:48:54.265 UTC [433] FATAL:  role "root" does not exist
postgres    | 2021-12-02 19:49:04.410 UTC [443] FATAL:  role "root" does not exist
What is missing here ?


test: [ "CMD-SHELL", "pg_isready" ].pg_isreadywithout-Uis going to use the system user as the database user. Pretty sure in this case the system user where the command is running isroot.pg_isreadyislibpqbased so it will recognize suitableenvvariables which for the user isPGUSERper libpq env notPOSTGRES_USER."pg_isready -U pguser"or addPGUSER: pgusertoenvironmentsection. Like I said I'm not a Docker user, so this is educated guesses at best.PGUSERand add-U pguserto thepg_isreadycommand, it does not work.