相关疑难解决方法(0)

Docker dpage/pgadmin4错误:指定的用户不存在

这是docker-compose.yml文件:

version: '3'

services:
############################
# Setup database container #
############################
  postgres_db:
    image: postgres
    restart: always
    ports:
      - ${POSTGRES_PORT}:${POSTGRES_PORT}
    environment: 
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - PGDATA=/var/lib/postgresql/data/pgdata
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - ./data:/var/lib/postgresql/data 
    networks:
      - db_network

  pgadmin:
    image: dpage/pgadmin4:4.19
    restart: always
    ports:
      - 8001:8080/tcp
    environment: 
      - PGADMIN_LISTEN_ADDRESS=0.0.0.0
      - PGADMIN_LISTEN_PORT=8080
      - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
      - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
    networks:
      - db_network

networks: 
  db_network:
    driver: bridge

Run Code Online (Sandbox Code Playgroud)

.env同一目录下有一个文件。

# The above refers to the name of the postgres container since using docker-compose
# This is because …
Run Code Online (Sandbox Code Playgroud)

postgresql pgadmin docker docker-compose pgadmin-4

5
推荐指数
1
解决办法
9803
查看次数

org.postgresql.util.PSQLException:致命:角色“amigoscode”不存在

我是 SpringBoot 的新手。我正在尝试创建一个使用 docker 运行的 Spring Boot 应用程序。当我运行这个应用程序时,出现以下错误

org.postgresql.util.PSQLException: FATAL: role "amigoscode" does not exist
Run Code Online (Sandbox Code Playgroud)

我没有任何提示,因为我无法追踪这个错误。角色“amigoscode”已存在。我附在 application.yml 和 docker-compose.yml 下面

应用程序.yml

server:
  port: 8080

spring:
  application:
    name: customer
  datasource:
    password: password
    url: jdbc:postgresql://localhost:5432/customer
    username: amigoscode
  jpa:
    hibernate:
      ddl-auto: create-drop
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: 'true'
    show-sql: 'true'
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

services:
  postgres:
    container_name: postgres
    image: postgres
    environment:
      POSTGRES_USER: amigoscode
      POSTGRES_PASSWORD: password
      PGDATA: /data/postgres
    volumes:
      - postgres:/data/postgres
    ports:
      - "5432:5432"
    networks:
      - postgres
    restart: unless-stopped

  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} …
Run Code Online (Sandbox Code Playgroud)

postgresql docker spring-boot docker-compose

5
推荐指数
1
解决办法
1628
查看次数