edd3693fb60db4075ebff6c97072b14ac62a304a
speed-data-docker
Debian-based Docker image that runs hourly network speed tests (using speedtest-cli) and serves a simple web UI.
Docker image
Docker1 image on Docker Hub
What the container provides
- Base: debian
- Installs: speedtest-cli
- Runs: a cron job to execute
run_speed_test.shhourly - Serves:
index.htmland generated JS files on port 8080 via busybox httpd
Files added/edited
Dockerfile- builds the imagestart.sh- entrypoint: starts cron and httpdrun_speed_test.sh- existing script (copied into image)
Build locally
Make sure Docker is installed locally. From the project root run:
docker build -t speed-data-app .
Prepare for Docker Hub
docker image build --no-cache -t asolkar/speed-data-docker:_VERSION_ .
docker push asolkar/speed-data-docker:_VERSION_
Run container
Run with a named Docker volume (recommended). The container serves on $PORT
inside the container (default 8080). Map a host port to the container port with
-p <host_port>:<container_port>.
docker volume create speed-data-volume
docker run -d --name speed-data -e PORT=8080 -p 8080:8080 --restart unless-stopped \
-v speed-data-volume:/var/www/data/speed \
speed-data-app
Alternatively, run with a host bind mount (for direct access to files on the host):
docker rm -f speed-data || true \
&& docker volume create speed-data-volume && \
docker run -d --name speed-data -e CRON_MINUTE=18 -e PORT=8080 -p 8585:8080 --restart unless-stopped \
-v ~/docker-data/speed-data-app/data:/var/www/data/speed speed-data-app
Verify
- Visit http://localhost:8080 to view
index.html(which readsspeedtest.jsandspeedtest.short.js). - Cron runs at minute 0 every hour. Logs go to
/var/log/cron.loginside the container.
Log in to running container for debug
docker exec -it _CONTAINER_ID_ /bin/bash
Notes
- Data files (
speedtest.js,speedtest.short.js, and the raw JSON file) are written to/var/www/data/speedinside the container. That path is declared as a Docker VOLUME in theDockerfileso you can mount a named volume or a host directory. - If you mount a host directory, ensure the directory is writeable by the container process. You can either:
- run the container as root (not recommended), or
- chown/chmod the host directory appropriately (e.g.,
chown 1000:1000 /path/on/hostorchmod a+rw /path/on/host) so the container can write files.
-
Note: AI agent used to Dockerize existing project ↩︎
Languages
HTML
70.7%
Shell
21.5%
Dockerfile
7.8%