Skip to content

NatashaRodic/mern-docker-app

Repository files navigation

Dockerizing the Application 🐳

This project is an example of a Dockerized MERN stack application, making it easy to build and run the application in a container.

Build the Docker image

To build your Docker image, run the following command:

docker build -t mern-app .

Run the Docker container with environment variables:

Use the following command to run the Docker container while passing environment variables for MongoDB Atlas and any other configuration:

docker run -p 3001:3001 \
-e MONGO_URI="mongodb+srv://<username>:<password>@cluster0.mongodb.net/<dbname>?retryWrites=true&w=majority" \
-e NODE_ENV=production \
mern-app

Stopping the container:

To stop the running container, first list the running containers:

docker ps

Then stop the container using its container ID:

docker stop <container_id>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published