Day 23: Jenkins Freestyle Project for DevOps Engineers

I am a software engineer with a foundation in software development and expertise in a suite of powerful tools including Docker, Kubernetes, Terraform, Ansible, Helm, Grafana, Prometheus, and Python.
Being AWS Certified further solidifies my proficiency in AWS services and cloud architecture. I am on a mission to master the principles of DevOps. My experience in crafting efficient and robust software solutions, combined with AWS certification, equips me with the skills to optimize processes and enhance system performance.
Let's build a better future through innovation and continuous improvement!
Continuous Integration and Continuous Deployment (CI/CD) are fundamental practices in modern software development. In this detailed tutorial, we'll break down the basics of CI/CD, understand the concept of a build job, and dive into creating Jenkins Freestyle Projects to automate Docker tasks. Whether you're a beginner or an experienced developer, this guide aims to make the process accessible to all.
Understanding CI/CD ๐
CI/CD involves automating the process of integrating code changes and deploying applications. This ensures that your code is consistently tested and delivered, promoting a more efficient and reliable development workflow.
What is a Build Job? ๐๏ธ
In Jenkins, a build job is a task that takes your source code, compiles it, runs tests, and produces artifacts. These jobs are a crucial part of CI/CD pipelines, guaranteeing that your application is in a deployable state.
Exploring Freestyle Projects ๐จ
Jenkins Freestyle Projects are user-friendly and flexible, making them an excellent starting point for CI/CD beginners. These projects allow you to configure build jobs without needing extensive scripting.
For the tasks that follow, I have used the below projects:
Task-01: Building and Running Docker Containers ๐ณ
Step 1: Create an Agent for Your App ๐ต๏ธโโ๏ธ
In Jenkins, go to "Manage Jenkins" > "Manage Nodes and Clouds."
Click "New Node" to create a new agent. Give it a name, choose "Permanent Agent," and configure the necessary settings.

Step 2: Configure a Freestyle Project โ๏ธ
Click on "New Item" on the Jenkins dashboard.
Enter a project name and choose "Freestyle project."
Under the "General" section, check "Restrict where this project can be run" and select your created agent.
Step 3: Add Build Steps ๐ ๏ธ
In the project configuration, navigate to the "Build" section.
Click on "Add build step" and choose "Execute shell" (for Unix-based systems) or "Execute Windows batch command" (for Windows).
For the "Command," enter
docker build -t your-app-image .to build your Docker image.Add a second build step by clicking "Add build step" again. Choose "Execute shell" or "Execute Windows batch command," and enter
docker run -d -p 8001:8001 your-app-imageto run your Docker container.
Step 4: Save and Build ๐พ
Save your project configuration.
Trigger a build by clicking "Build Now" on the project dashboard.

Jenkins will now execute the specified build steps, creating a Docker image and running a container for your app.
Step 5: Manual Browser Testing ๐
Open your preferred web browser.
Navigate to
http://localhost:8080to access your Todo App manually.
Task-02: Docker Compose Automation ๐ค
Step 1: Create a Jenkins Project ๐๏ธ
- Create a new Freestyle Project following the steps above.
Step 2: Configure Build Steps โ๏ธ
Under the "Build" section, click "Add build step" and choose "Execute shell" or "Execute Windows batch command."
Enter the command
docker-compose -f path/to/your/docker-compose-file.yml up -dto start multiple containers defined in your Docker Compose file.Add a cleanup step by clicking "Add build step" again. Choose "Execute shell" or "Execute Windows batch command," and enter
docker-compose -f path/to/your/docker-compose-file.yml downto stop and remove containers.
Step 3: Save and Run ๐พ
Save your project configuration.
Trigger a build to see Jenkins automating the deployment of your Docker Compose application.
Step 4: Manual Browser Testing for Two-Tier Flask App ๐
Open your preferred web browser.
Navigate to
http://localhost:5000to access your Two-Tier Flask App manually.
With these detailed steps, even beginners can successfully set up Jenkins Freestyle Projects for Docker automation. Remember, practice is key, so feel free to experiment with different configurations to enhance your CI/CD skills. Happy coding! ๐
Let's connect on LinkedIn




