Install Docker
Choose your operating system and follow the install instructions.
Download and install Docker Desktop for Mac from the official Docker website. Supports both Intel and Apple Silicon (M1/M2/M3).
docker --version
docker commands.
Download and install Docker Desktop for Windows. Requires WSL 2 backend — Docker Desktop will guide you through enabling it.
docker --version
Install Docker Engine directly via your package manager. The commands below work on Ubuntu / Debian.
sudo apt-get update && sudo apt-get install -y docker.io
sudo systemctl start docker && sudo systemctl enable docker
sudo usermod -aG docker $USER && newgrp docker
Pull the Expense Tracker image
Download the official image from Docker Hub.
Run the command below to pull the latest version of the image to your local machine.
docker pull abhix09/expense-tracker
:latest or a specific version tag.
Configure environment variables
Set these variables when running the container.
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
change-me |
Flask secret key — set a long random string in production. |
JWT_SECRET_KEY |
change-me-jwt |
Signs JWT tokens — must be kept private. |
MONGO_URI |
mongodb://localhost:27017 |
MongoDB connection string. |
MONGO_DB_NAME |
expense_tracker |
Name of the MongoDB database to use. |
FLASK_ENV |
production |
Set to development for debug mode. |
Run the container
Start Expense Tracker with a single command.
Replace the placeholder values with your own secrets and MongoDB URI, then run:
docker run -d -p 5000:5000 --name expense-tracker -e SECRET_KEY=your-secret -e JWT_SECRET_KEY=your-jwt-secret -e MONGO_URI=mongodb://host.docker.internal:27017 abhix09/expense-tracker
docker ps
host.docker.internal lets the container reach MongoDB running on your host machine. On Linux you may need to pass --add-host=host.docker.internal:host-gateway instead.