services: postgres: image: postgres hostname: postgreshost env_file: - .env environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${POSTGRES_DB} ports: - ${POSTGRES_PORT}:5432 volumes: - postgres_data:/var/lib/postgresql - ./init:/docker-entrypoint-initdb.d - ./data:/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 3 pgadmin: image: dpage/pgadmin4 env_file: - .env environment: - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} - POSTGRES_HOST=postgreshost - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${POSTGRES_DB} - PGADMIN_CONFIG_SERVER_MODE=False - PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False ports: - ${PGADMIN_PORT}:80 depends_on: postgres: condition: service_healthy user: root volumes: - ./pgadmin/servers.json:/pgadmin4/servers.json volumes: postgres_data: