I am using docker-compose to create applications and mongodb containers .
The below line of code creates a mongoDB container and I am referring the service name “mongodb-service” in application containers to connect to mongoDB .
I am doing A POC , where I need to connect to mongoDB atlas not to mongoDB container.
How I can connect to mongoDB atlas as a service , how to define HOST URL and user name password in that service .
mongodb:
image: mongo:latest
ports:
- 27017:27017
networks:
mynetwork:
aliases:
- mongodb-service
volumes:
- vol-mongo-db:/mongo/db
- vol-mongo-configdb:/mongo/configdb