microsoft / microsoft/vscode-pgsql

fails to connect when using host.docker.internal

Open
#206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
395
Forks
33
Avg merge
1h 46m
Merged PRs (30d)
3

Description

Describe the bug

When used with a devcontainer, unable to connect to host.docker.internal , seems to try to resolve an IPv6 address, and fails to connect.

Works correctly from the terminal
psql "postgresql://postgres:...@host.docker.internal:5432/postgres?sslmode=disable" -c "SELECT now(), version();"

Works correctly from VSCode using ckolkman.vscode-postgres

To Reproduce

connect to postgres running under docker, from another devcontainer.

postgresql://postgres:...@host.docker.internal:5432/postgre

Expected behavior

connection

Screenshots

Image

VS Code version

Version: 1.107.1 (user setup)
Commit: 994fd12f8d3a5aa16f17d42c041e5809167e845a
Date: 2025-12-17T14:15:14.850Z
Electron: 39.2.3
ElectronBuildId: 12895514
Chromium: 142.0.7444.175
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

Extension Logs

See: https://github.com/microsoft/vscode-pgsql?tab=readme-ov-file#usage-and-feedback

Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the PostgreSQL connection from one devcontainer to a database running in Docker, using the host.docker.internal URL from the report. Compare the extension's connection behavior with psql and ckolkman.vscode-postgres, focusing on IPv6 resolution; done means the reported connection succeeds from the devcontainer.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.