I am trying to connect to postgres database running on docker container from visual studio, I am sure the DB exists and here is the logs:
docker ps:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a84a2dabf8a6 postgres "docker-entrypoint.s…" 10 minutes ago Up 10 minutes 0.0.0.0:5432->5432/tcp catalogdb
My connection string:
"ConnectionStrings": {
"Database": "Server=localhost;Port=5432;Database=CatalogDb;User Id=postgres;Password=postgres;Include Error Detail=true;"
}
inside docker container:
postgres=# l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
-----------+----------+----------+-----------------+------------+------------+------------+-----------+-----------------------
CatalogDb | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
postgres | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
template0 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(4 rows)
the error:
Npgsql.PostgresException (0x80004005): 3D000: database “CatalogDb” does not exist
I try to connect postgresql Db from visual studio to existing Database but got database does not exist error. How can I connect to psql db running on docker container from visual studio.