This is a basic Go lang project that shows your age if you know your birth year. In this, you have to input your birth year, and it will take the current year automatically. By using the formula Current Year - Birth Year, it shows your current age. This project is mainly intended to learn how to containerize an application. It is not a Go-focused project but mainly Docker-focused instead. A Dockerfile will be created to build a Docker image and run it inside a container.
Once containerized, the application can be run easily using Docker commands on any system that supports Docker, regardless of the host environment. This helps demonstrate the power of containerization and the portability it brings to software development.
The project will also serve as a base to practice Docker fundamentals like:
-> Writing a Dockerfile
-> Building a lightweight image for a Go application
-> Running the image as a container
-> Understanding how to manage input/output inside the container
Overall, this project provides a practical, beginner-friendly example of containerizing a simple application β making it a great starting point for learning Docker and DevOps workflows.
Setup and Usage
π Step 1: Clone the repository:
git clone https://github.com/kartik-paliwa1/Know-Your-Age
cd Know-Your-Age
πStep 2: Create a Dockerfile:
FROM golang:1.20-alpine
WORKDIR /app
COPY . .
RUN go build -o age-calculator Main.go
CMD ["./age-calculator"]
π οΈ Step 3: Build the Docker Image
docker build -t age-calculator .
(-t age-calculator: Tags the image with a custom name
.: Refers to the current directory as the Docker context)
βΆοΈ Step 4: Run the Docker Container
docker run -it age-calculator
When prompted, enter your birth year inside the container and see your age output.
Refer to my Github repository for my project : [https://github.com/kartik-paliwa1/Know-Your-Age]
Top comments (0)