This repository demonstrates a complete Jenkins setup on AWS EC2, designed to create a CI/CD-ready environment using Docker-based build agents.
The project highlights practical DevOps implementation commonly used in real-world production pipelines.
Key objectives include installing Jenkins, configuring Docker as a Jenkins agent, enabling CI/CD workflows, and preparing the setup for Kubernetes-based deployments.
- Log in to the AWS Management Console
- Navigate to EC2 → Instances
- Launch a new Ubuntu-based EC2 instance
- Java (OpenJDK)
sudo apt update
sudo apt install openjdk-17-jreVerify installation:
java -versioncurl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkinsJenkins runs on port 8080, which must be allowed in the EC2 security group.
- EC2 → Instances → Select your instance
- Open the Security tab
- Edit inbound rules
- Allow TCP port 8080
Open Jenkins in the browser using:
http://<EC2_PUBLIC_IP>:8080
You can find the EC2 public IP address in the AWS EC2 console.
After accessing Jenkins:
- Retrieve the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword- Paste the password into the Jenkins setup screen
- Install suggested plugins
- Create an admin user (recommended)
Wait for Jenkins to complete the plugin installation.
Creating an admin user is recommended for long-term and production-like usage.
Jenkins installation is now complete and ready for use.
To enable Docker-based builds in Jenkins:
- Log in to Jenkins
- Go to Manage Jenkins → Manage Plugins
- Open the Available tab
- Search for Docker Pipeline
- Install the plugin and restart Jenkins
Wait for Jenkins to restart after plugin installation.
sudo apt update
sudo apt install docker.ioAdd Jenkins and Ubuntu users to the Docker group:
sudo usermod -aG docker jenkins
sudo usermod -aG docker ubuntu
sudo systemctl restart dockerRestart Jenkins to apply permission changes:
http://<EC2_PUBLIC_IP>:8080/restart
Docker is now successfully configured as a Jenkins build agent.
- Jenkins installed and configured on AWS EC2
- Docker integrated as a Jenkins build agent
- CI/CD-ready infrastructure established
- Foundation prepared for Kubernetes and advanced DevOps workflows







