Skip to content

uday770202/SimpleTimeService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•’ SimpleTimeService

A minimalist Python Flask app that returns the current UTC timestamp and the client's IP address in JSON format.


πŸ”§ How to Build & Run

1. Build the Docker Image

docker build -t simple-time-service .

2. Run the Docker Container

docker run -p 5000:8080 simple-time-service

3. Access the Service

βœ… If running locally:

Open your browser or use curl:

http://localhost:5000
curl http://localhost:5000

βœ… If accessing from inside another Docker container:

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>

βœ… Example JSON Response

{
  "timestamp": "2025-04-14T13:00:00Z",
  "ip": "172.17.0.1"
}

πŸ“€ Optional: Push to DockerHub

docker tag simple-time-service yourdockerhubusername/simple-time-service
docker push yourdockerhubusername/simple-time-service

βœ… Done!

Your service is now running and accessible at:

  • http://localhost:5000 – from your host machine
  • http://<container-ip>:8080 – from inside Docker network

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published