Quantcast
Channel: Форум программистов и сисадминов Киберфорум
Viewing all articles
Browse latest Browse all 520047

Как запустить Postgresql 15.x в docker контейнере? - PostgreSQL

$
0
0
Хочу запустить PostgreSQL в докере. Делаю так потому, что это облегчает миграцию между host операционками что важно в процессе разработки.
У меня есть две инструкции https://habr.com/ru/articles/578744/ и https://hevodata.com/learn/docker-postgresql/
Действую по второй инструкции: после второго запуска (docker run --name postgresql -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=custompassword -p 5432:5432 -v /data:/var/lib/postgresql/data -d postgres) пытаюсь подключиться своим Java приложением с использованием ранее установленного пароля и получаю отказ в авторизации с таким логом

Код:

└─$ docker logs 99691c70698b

PostgreSQL Database directory appears to contain a database; Skipping initialization

2023-06-09 13:58:38.652 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-06-09 13:58:38.653 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-06-09 13:58:38.653 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-06-09 13:58:38.662 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-06-09 13:58:38.670 UTC [29] LOG:  database system was shut down at 2023-06-09 13:58:04 UTC
2023-06-09 13:58:38.677 UTC [1] LOG:  database system is ready to accept connections
2023-06-09 13:58:43.492 UTC [33] LOG:  invalid length of startup packet
2023-06-09 13:58:52.636 UTC [34] FATAL:  password authentication failed for user "postgres"
2023-06-09 13:58:52.636 UTC [34] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2023-06-09 14:03:30.404 UTC [44] FATAL:  password authentication failed for user "postgres"
2023-06-09 14:03:30.404 UTC [44] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2023-06-09 14:03:38.766 UTC [27] LOG:  checkpoint starting: time
2023-06-09 14:03:38.783 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.006 s, sync=0.003 s, total=0.018 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB
2023-06-09 14:19:14.076 UTC [76] LOG:  invalid length of startup packet
2023-06-09 14:21:32.667 UTC [82] FATAL:  password authentication failed for user "postgres"
2023-06-09 14:21:32.667 UTC [82] DETAIL:  Role "postgres" does not exist.
        Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"

пытаюсь использовать psql
Код:

┌──(katya5㉿computer)-[~]
└─$ psql --username=postgres --dbname=postgres
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

Пожалуйста, скажите мне что я делаю неправильно? Как подключиться к контейнеру используя psql хост-системы? Может быть есть какая-нибудь более подробная инструкция которая могла бы быть мне полезна? Спасибо

Viewing all articles
Browse latest Browse all 520047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>