Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Can't connect to database at 127.0.0.1 with docker run supabase/pgadmin-schema-diff #26

Open
karolzlot opened this issue Oct 17, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@karolzlot
Copy link

karolzlot commented Oct 17, 2021

Bug report

Describe the bug

Can't connect to database at 127.0.0.1 with docker run supabase/pgadmin-schema-diff

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

I have local database running in docker. I can easily connect to it using either psql connection_string or psycopg2.connect(connection_string), but when I use the same connection_string with docker run supabase/pgadmin-schema-diff I am getting:

docker run supabase/pgadmin-schema-diff 'postgres://XXX:[email protected]:5432/postgres' 'postgres://postgres:[email protected]:6543/postgres' > diff_demo1.sql
Starting schema diff...
Traceback (most recent call last):
  File "cli.py", line 398, in <module>
    src_db_id, src_schema_id = get_db_and_schema_id(
  File "cli.py", line 227, in get_db_and_schema_id
    conn = psycopg2.connect(connection_string)
  File "/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect  
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

It seems to me that because this tool runs in docker it has it's own 127.0.0.1.

Expected behavior

It should connect and make diff

Screenshots

n/a

System information

  • OS: I tested on both Windows and Ubuntu on WSL2
  • Browser (if applies) n/a
  • Version of supabase-js: n/a
  • Version of Node.js: n/a

Additional context

n/a

@karolzlot karolzlot added the bug Something isn't working label Oct 17, 2021
@karolzlot karolzlot changed the title Can't connect to database at 127.0.0.1 Can't connect to database at 127.0.0.1 with docker run supabase/pgadmin-schema-diff Oct 17, 2021
@karolzlot
Copy link
Author

karolzlot commented Oct 17, 2021

I solved it with this hack: https://stackoverflow.com/a/24326540/8896457

@karolzlot
Copy link
Author

Now I try to solve another error: #3

@caenguidanos
Copy link

Try with: docker run --network host supabase/...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants