ramangupta21/flask-mongodb-app

By ramangupta21

Updated over 1 year ago

This Docker image contains a Python Flask application configured to interact with MongoDB.

Image
Languages & frameworks
0

56

ramangupta21/flask-mongodb-app repository overview

Overview:-

This Docker image provides a streamlined development environment for a Flask-based web application integrated with MongoDB. This containerized application is designed to facilitate the creation, storage, and retrieval of data using a RESTful API. It is ideal for developers looking to quickly deploy and test a Flask application with MongoDB backend, all within an isolated Docker environment.

What This Image Does:-

This image sets up a Flask web application that communicates with a MongoDB database. The application exposes two endpoints:

/data (POST): Allows insertion of data into the MongoDB collection. /data (GET): Retrieves and displays the stored data in JSON format. By leveraging Flask for the web framework and MongoDB for database storage, this image provides a robust foundation for building and testing web applications.

How to Run This Image:-

Pull the Image:-

Download the Docker image from Docker Hub using the following command:-

docker pull ramangupta21/flask-mongodb-app:latest

Run the MongoDB Container:

Start a MongoDB container to serve as the database:

docker run --name mongodb -d mongo:latest

Run the Flask Application Container:

Launch the Flask application container, linking it to the MongoDB container:

docker run --name flask-app --link mongodb:mongo -p 5000:5000 -d ramangupta21/flask-mongodb-app:latest

Access the Application:

The Flask application will be available at http://localhost:5000. You can interact with the API using tools like curl or Postman to test the POST and GET endpoints.

For example, to insert data, you can use:

curl -X POST -H "Content-Type: application/json" -d '{"sampleKey":"sampleValue"}' http://localhost:5000/data

To retrieve data, you can use:

Notes:- Ensure Docker is installed and running on your machine. Replace localhost with the appropriate IP address or hostname if running in a different environment.

This Docker image provides a complete, self-contained environment for developing and testing a Flask application with MongoDB, simplifying the setup process and enabling quick deployment.

Tag summary

Content type

Image

Digest

sha256:37ee2d5fa

Size

61.1 MB

Last updated

over 1 year ago

docker pull ramangupta21/flask-mongodb-app