This is a simple Express application built using TypeScript.
Here, we learn how Docker networking works — specifically, how one container talks to another using Docker's built-in networking.
- 📦 Running multiple containers
- 🔗 Connecting containers using Docker networks
- 🗃️ Connecting a backend to a MongoDB container
Follow these steps carefully:
docker network create <your-network-name>docker run -d -p 27017:27017 --name mongo --network <your-network-name> mongoconst uri = "mongodb://mongo:27017/<your-db-name>";docker build -t my-backend .
docker run -p 3000:3000 --name my-app --network <your-network-name> my-backendResult = mongoDB connected
Docker-compose.yaml is added - will create two container
- The mongogb will start.
- The backend process will start.
- Volume will be created to store the data.