Skip to main content

Command Palette

Search for a command to run...

Using host.docker.internal

Updated
1 min readView as Markdown
Using host.docker.internal
V

Engineer working in Cerebras. Latest work is Cerebras Inference. I love writing code in React, TypeScript, C++, Python. I spend most of my work hours tinkering with code.

I have a docker container that wants to use PostGresDB on the host machine in port 5432. How do I connect to the host PostGres server?

Answer: Use host.docker.internal in the connection string

POSTGRES_PRISMA_URL=postgresql://postgres:postgres@host.docker.internal/dbname

host.docker.internal works only with Mac or Windows, does not work in Linux!

21 views

More from this blog

V

Vijay Thirugnanam

38 posts

Short technical tips. Mostly stuff that I can refer to later.