Hi, any docker geniuses here? I'm having a nightma...
# orm-help
d
Hi, any docker geniuses here? I'm having a nightmare trying to connect to my db with Prisma 2 client in docker and looking for some help if possible.
e
did you open up the port of the db container to localhost? then you can access at localhost in the db url
d
I can access the db remotely but not from the docker container containing my app.
e
oh okay, yeah I'm not sure I'd be of much help there
d
Thanks for trying 👍
d
Does your app refer to the DB as
localhost
? The from within the docker container, you won't be able to access it as
localhost
from inside the container is that container. Consider changing it to the "name" of the database container
If you are on Mac then this will also work as DB host name
host.docker.internal
From inside a container, it maps to the IP of the host. https://docs.docker.com/desktop/mac/networking/
d
I've tried both the internal and external ip, I'll give the docker name a whirl, thanks. This is on a server.
PrismaClientInitializationError: Can't reach database server at `fabdefense`:`2345`
'2345' being the port number I run it on