Common Issues
Docker Permission Denied Error
Docker Permission Denied Error
Problem: Jenkins build fails with a permission denied error when trying to run Docker commands.Error Message:Solution: Add the Jenkins user to the Docker group:After running these commands, restart your Jenkins service and trigger a new build.
GitHub Webhook Not Triggering Builds
GitHub Webhook Not Triggering Builds
Problem: Pushing code to GitHub doesn’t automatically trigger the Jenkins pipeline.Possible Causes:
- Webhook not configured correctly in GitHub
- Jenkins URL not accessible from GitHub
- Wrong payload URL in webhook settings
-
Verify webhook configuration in GitHub:
- Go to your repository → Settings → Webhooks
- Payload URL should be:
http://<ec2-public-ip>:8080/github-webhook/ - Content type:
application/json - Events: Select “Just the push event”
-
Check Jenkins is accessible:
- Verify EC2 security group allows inbound traffic on port 8080
- Check webhook delivery history in GitHub for error messages
Build Fails: Port Already in Use
Build Fails: Port Already in Use
Problem: Deploy stage fails because port 80 is already in use.Error Message:Solution: Stop and remove the existing container:Or modify your Jenkinsfile to remove old containers before deploying:
npm Install or Test Failures
npm Install or Test Failures
Problem: The Test stage fails during npm install or npm test.Common Causes:
- Missing
package.jsonin the repository - No test scripts defined
- Network issues downloading dependencies
-
Ensure
package.jsonexists in your repository root -
If you don’t have tests yet, the Jenkinsfile already handles this:
-
For network issues, check internet connectivity from EC2:
Docker Image Build Fails
Docker Image Build Fails
Problem: Build stage fails when creating the Docker image.Common Causes:
- Missing or incorrect Dockerfile
- Syntax errors in Dockerfile
- Docker daemon not running
- Verify Dockerfile exists in repository root
-
Check Docker daemon status:
-
Start Docker if it’s not running:
-
Test Docker image build manually:
Cannot Access Application on Port 80
Cannot Access Application on Port 80
Problem: Pipeline succeeds but application is not accessible at
http://<ec2-public-ip>.Solution:-
Check EC2 security group inbound rules:
- Port 80 (HTTP) should be open to 0.0.0.0/0 or your IP
-
Verify container is running:
-
Check container logs:
-
Test locally on EC2 instance:
- Ensure the application is listening on the correct port (3000 internally, mapped to 80 externally)
Jenkins Service Won't Start
Jenkins Service Won't Start
Problem: Jenkins service fails to start or crashes.Solution:
-
Check Jenkins logs:
-
Verify Java is installed:
-
Check available disk space:
-
Restart Jenkins:
-
If port 8080 is in use, change Jenkins port in
/etc/default/jenkins
General Debugging Tips
Check Console Output
Always review the full console output in Jenkins for detailed error messages and stack traces.
Verify Prerequisites
Ensure Docker, Jenkins, and required plugins are properly installed and running.
Test Components Individually
Test Docker builds and npm commands manually before running the full pipeline.
Review Logs
Check Jenkins logs, Docker logs, and application logs for detailed error information.
Getting Help
If you continue to experience issues:- Review the complete console output in Jenkins
- Check all relevant log files
- Verify your configuration matches the setup guide
- Search for similar issues in Jenkins and Docker documentation