Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

containerized-python-app

A minimal Python web app, built with Flask, that listens on a port and prints a message to the console every time it's accessed. Created as a Docker exercise: it demonstrates how to package and run a Python app inside a Docker container.

Project structure

containerized-python-app/
├── app.py
├── requirements.txt
├── Dockerfile
├── .dockerignore
└── README.md

File description

File Purpose
app.py The Flask app.
requirements.txt Python dependencies.
Dockerfile Defines how to build the Docker image.
.dockerignore Excludes unnecessary files from the image.

Running with Docker

Build the image:

docker build . -t yourname

Run it:

docker run --rm -p 8080:8080 yourname

Then open your browser (or run curl) at:

http://localhost:8080

Each time the page is accessed, the app prints a message to the container logs (docker logs <container>) and returns the same message in the response.

Running without Docker

python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python app.py

Then open http://localhost:8080.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages