wazzaday
wazzaday

Reputation: 9664

How to connect to host database from docker (Prisma)

I have created a new (local) project with prisma init. But I cannot connect to my hosts PostgreSQL database. I have tried setting the host to :

host: docker.for.mac.host.internal

But when I visit the the playground all I get is the following error :

Project not found: 'default$default

How can I connect Prisma to the database running on my local machine, outside of the container?

The full docker-compose.yml looks like :

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.8
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: postgres
            host: docker.for.mac.host.internal
            port: '5432'
            database: mydb
            user: myusername
            password: ''
            migrations: false

Upvotes: 1

Views: 1805

Answers (1)

user1738546
user1738546

Reputation: 679

Have you tried deploying first? in a terminal change to the directory with the prisma.yml and deploy your Prisma server $ cd [dir of prisma.yml] then $ prisma deploy

Upvotes: 3

Related Questions