Do It Yourself - Exercise
Automation Using Dockerfile - Exercise 2
We'll cover the following
In the first exercise, we created a script that will print the current time and then we modified it to print the current date.
In this exercise, we will proceed with that. If you have those files with you, that’s great. If not, don’t worry. You can create it again. So, let’s proceed with a note.
Understand the why and what of every command you use to complete this exercise. Try not to share the answers with peers in discussion forums. It will help to maintain a healthy competition as well as a will to complete the exercises ethically.
Problem statement
In this exercise, you will:
-
Write a script to print the current time with timezone and the current date.
-
Write a Dockerfile to create an executable container from it which will show the current date and time with a timestamp.
Ex. Whenever you build the image using the created Dockerfile and fork a container from it, it should print the timestamp and exit.
In this exercise, you have to use the “pytz” library, so create a requirements.txt file and (use this) this as a requirement.
Get hands-on with 1400+ tech skills courses.