1 | initial version |
To use MongoDB in Azure App Service through Docker-Compose, follow these steps:
version: "3.8"
services:
app:
build: .
ports:
- "3000:3000"
depends_on:
- db
environment:
- MONGODB_URI=mongodb://db:27017/mydatabase
db:
image: mongo:latest
restart: always
volumes:
- db_data:/data/db
volumes:
db_data:
Replace the "mydatabase" with the name of your database that you want to connect to.
Create a new Azure App Service instance and configure it to use Docker-Compose for deployment.
Deploy your application to Azure App Service by uploading your Docker-Compose file.
Verify that your application is running by checking the logs of your Azure App Service instance.
Connect to MongoDB by using the MONGODB_URI environment variable that you defined in your Docker-Compose file.
Now you can use MongoDB in Azure App Service through Docker-Compose.