kartoza / docker-postgis

Dockerfile for postgis
GNU General Public License v2.0
660 stars 313 forks source link

Unable to connet from command line #483

Closed kapdom closed 2 weeks ago

kapdom commented 1 month ago

What is the bug or the crash?

Unable to connect to db from CL. When I try connect i receive following error:

root@be5cbb137675:/scripts# psql -U docker -W
Password: 
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "docker"

as a password I type in "docker"

Steps to reproduce the issue

  1. Build docker container from docker compose
    services:
    postgres_db:
        container_name: postgres_db
        image: kartoza/postgis:16-3.4
        restart: always
        environment:
           POSTGRES_MULTIPLE_EXTENSIONS: postgis,hstore,postgis_topology,postgis_raster,pgrouting
        ports:
           - '5432:5432'
    pgadmin:
      container_name: pgadmin4_container
      image: dpage/pgadmin4
      restart: always
      environment:
          PGADMIN_DEFAULT_EMAIL: admin@admin.com
          PGADMIN_DEFAULT_PASSWORD: root
      ports:
          - "5050:80"

output: Screenshot from 2024-10-08 14-38-50

  1. Enter on container: docker compose exec postgres_db bash
  2. Try to connect from CL psql -U docker -W
  3. Any other user listed in output not working

Versions

kartoza/postgis:16-3.4

Additional context

What should be done to enter in db from command line?

NyakudyaA commented 2 weeks ago

Please read the instructions or https://gprivate.com/6e0lk