Rosario Borgesi
PPrisma
•Created by Rosario Borgesi on 12/27/2024 in #help-and-questions
Prisma Mongodb & Express Res API Docker
Hi I am tryin to create a docker compose that ecompasses A Rest API in Prisma and Express.js and a MongoDB Database. I am using this docker-compose file:
name: 'proofifi-project'
services:
mongo:
# This image automatically creates a replica set required for transactions
image: prismagraphql/mongo-single-replica:4.4.3-bionic
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: prisma
MONGO_INITDB_DATABASE: proofifi
MONGO_REPLICA_HOST: host.docker.internal
MONGO_REPLICA_PORT: 27017
INIT_WAIT_SEC: 3
ports:
- 27017:27017
hostname: mongo
container_name: mongo
networks:
- proofifi-network
backend:
build:
context: ../../backend
dockerfile: Dockerfile
ports:
- 3001:3001
environment:
- DATABASE_URL=mongodb://root:prisma@localhost:27017/proofifi?authSource=admin&retryWrites=false
depends_on:
- mongo
hostname: backend
container_name: backend
networks:
- proofifi-network
volumes:
mongo-data:
networks:
proofifi-network:
driver: bridge
But I get always the same error:
Message:
Kind: Server selection timeout: No available servers. Topology: { Type: Unknown, Servers: [ { Address: localhost:27017, Type: Unknown, Error: Kind: I/O error: Connection refused (os error 111), labels: {} } ] }, labels: {}
Do you guys know if there is a docker compose that encompasses a prisma rest api and mongodb?5 replies