A minimalist Python Flask app that returns the current UTC timestamp and the client's IP address in JSON format.
docker build -t simple-time-service .
docker run -p 5000:8080 simple-time-service
Open your browser or use curl:
http://localhost:5000
curl http://localhost:5000
Use the internal container IP:
http://172.17.0.2:8080
To find the containerβs IP address, run:
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_id>
{
"timestamp": "2025-04-14T13:00:00Z",
"ip": "172.17.0.1"
}
docker tag simple-time-service yourdockerhubusername/simple-time-service
docker push yourdockerhubusername/simple-time-service
Your service is now running and accessible at:
http://localhost:5000
β from your host machinehttp://<container-ip>:8080
β from inside Docker network