This is a minimal Flask Hey There Python application running inside a Docker container.
The application exposes a single endpoint that returns a JSON message.
. โโโ index.py โโโ requirements.txt โโโ Dockerfile โโโ README.md
The Flask app runs on port 3000 and returns the following response on /:
{"message":"Hey There Python"}
๐ How to Run Using Docker
๐น Build Docker Image
docker build -t rahulrokksss/python-flask:0.0.1.RELEASE .
๐น Run Docker Container
docker run -d -p 4000:3000 rahulrokksss/python-flask:0.0.
1.RELEASE
๐น Access the Application
Open your browser or use curl:
http://localhost:4000
๐ณ Docker Hub Image
The image is available on Docker Hub:
rahulrokksss/python-flask:0.0.1.RELEASE
๐ Tech Stack
Python
Flask
Docker
โ
Output Example
{"message":"Hey There Python"}
๐ Notes
Flask runs on 0.0.0.0 to allow external access from Docker
Port 3000 is exposed inside the container
Port 4000 is used on the host machine
โจ Author
Rahul Shukla