Localhost Database inaccessible
See original GitHub issueMy DBT project accesses the database from localhost. The database itself is remote but the connection is tunnelled to localhost:5433 as it can only be accessed using a VPN from a particular host. Anyway, all this to say that if your ~/.dbt/profiles.yml
host
key has localhost
as a value, then you get an error like the below after it tries and fails to access the database for some time:
DbtError: Error returned from dbt while executing method 'poll': Database Error
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5433?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5433?
I use a mac and I can bypass this by changing localhost
to host.docker.internal
if running Docker 18.03 or later but it would be nice if there was a better solution that didn’t require me changing this. Also not sure what non-mac users need to do in order to access localhost from within the container. This should be mentioned in your docs as it seems you are assuming everyone’s database is remote. My particular case is probably niche but many may be using a local database for dev purposes
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
@TuringLovesDeathMetal I’ve added a docs update to help users workaround this but the underlying issue isn’t solved.
you still have to modify your
profiles.yml
to get this to work, which isn’t ideal. I’m leaving “open” but removing from the dev board until we revisit it.No prob!
I’m going to add something to the docs for using
host.docker.internal
- I think that’s the best we have currently! Watch this space though