@@ -16,27 +16,50 @@ A Docker container that monitors your internet connection speed (download and up
1616
1717## 🐳 Usage
1818
19+ ### 🚀 Quickstart (Docker run)
20+
21+ #### 🔹 Using Docker Run
22+
23+ Run the container directly from Docker Hub with scheduled checks and environment configuration:
24+
25+ ``` bash
26+ docker run -d \
27+ --name speedtest-monitor \
28+ -e CRON_SCHEDULE=" 30 * * * *" \
29+ -e MIN_DOWNLOAD=270 \
30+ -e MIN_UPLOAD=260 \
31+ -e TELEGRAM_BOT_TOKEN=" " \
32+ -e TELEGRAM_CHAT_ID=" " \
33+ --restart unless-stopped \
34+ samuelrb/speedtest-monitor:latest
35+ ```
36+
37+ #### 🔹 Using Docker Compose
38+ ``` bash
39+ docker compose up -d
40+ ```
41+
1942### Build
2043``` bash
21- docker build -t speedtest-monitor .
44+ docker build -t speedtest-monitor docker
2245```
2346### Run simple (without telegram notifications)
2447``` bash
25- docker run -d --restart=always --name speedtest-monitor speedtest-monitor
48+ docker run -d --restart=always --name speedtest-monitor samuelrb/ speedtest-monitor
2649```
2750### Run with options all options (remove unused options)
2851
2952``` bash
3053docker run -d \
31- -e MIN_DOWNLOAD=1000 \
32- -e MIN_UPLOAD=1000 \
54+ -e MIN_DOWNLOAD=1000 \
55+ -e MIN_UPLOAD=1000 \
3356 -e SERVER_ID=12345 \
3457 -e TELEGRAM_BOT_TOKEN=" 1234567:AABCC123_asdfjnnASDF" \
3558 -e TELEGRAM_CHAT_ID=" 12345667" \
3659 -e CRON_SCHEDULE=" * * * * *" \
3760 --restart=always \
3861 --name speedtest-monitor \
39- speedtest-monitor
62+ samuelrb/ speedtest-monitor
4063```
4164
4265### Output
@@ -56,7 +79,7 @@ docker logs -f speedtest-monitor
5679
5780You can receive speed alerts via Telegram if the measured download or upload speeds fall below the configured thresholds.
5881
59- To enable this feature, set the environment variables ` TELEGRAM_BOT_TOKEN ` and `TELEGRAM_CHAT_ID.
82+ To enable this feature, set the environment variables ` TELEGRAM_BOT_TOKEN ` and ` TELEGRAM_CHAT_ID ` .
6083
6184#### 📤 Example Telegram message
6285
@@ -70,10 +93,10 @@ To enable this feature, set the environment variables `TELEGRAM_BOT_TOKEN` and `
7093### ⚙️ Environment Variables
7194
7295| Variable | Description | Default |
73- | ---------| ----------------------------------------| --------- |
74- | ` MIN_DOWNLOAD ` | Minimum download speed threshold (Mbps) | 200 |
75- | ` MIN_UPLOAD ` | Minimum upload speed threshold (Mbps) | 200 |
76- | ` SERVER_ID ` | Optional Speedtest server ID to use. | Auto |
96+ | ---------| ----------------------------------------| ------|
97+ | ` MIN_DOWNLOAD ` | Minimum download speed threshold (Mbps) | 200 |
98+ | ` MIN_UPLOAD ` | Minimum upload speed threshold (Mbps) | 200 |
99+ | ` SERVER_ID ` | Optional Speedtest server ID to use. | Auto |
77100| ` TELEGRAM_BOT_TOKEN ` | Your Telegram bot's token | void |
78101| ` TELEGRAM_CHAT_ID ` | Your personal chat ID or group chat ID | void |
79102| ` CRON_SCHEDULE ` | The cron expression to schedule script | 0 * * * * |
@@ -90,6 +113,28 @@ By default, Speedtest runs every hour. You can modify the schedule by editing th
901130 * * * * /usr/local/bin/speedtest-check.sh >> /proc/1/fd/1 2>&1
91114```
92115
116+ ## 🔹 Using Host Cron (ephemeral container)
117+ This method allows the container to run only when scheduled by the host system. Ideal for minimizing resource usage.
118+
119+ Create a cron job on your machine (host) with the following line:
120+
121+ ``` bash
122+ 0 * * * * docker run -d --rm \
123+ -e MIN_DOWNLOAD=270 \
124+ -e MIN_UPLOAD=260 \
125+ -e TELEGRAM_BOT_TOKEN=" your_bot_token" \
126+ -e TELEGRAM_CHAT_ID=" your_chat_id" \
127+ samuelrb/speedtest-monitor:latest /usr/local/bin/speedtest-check.sh
128+ ```
129+
130+ Save it with ` crontab -e `
131+
132+ No ` CRON_SCHEDULE ` is needed, since the scheduling is external.
133+
134+ This overrides the default CMD and directly executes the check script.
135+
136+ ✅ This is the most lightweight approach — Docker runs only during the test, then shuts down.
137+
93138## 🧪 Tests (Optional)
94139To validate the container before publishing, you can test the script with:
95140
0 commit comments