Software Development

What is the most effective way to change the default port for a Jenkins server from 8080?

MA Asked by Marcus Thorne · 04-02-2025
0 upvotes 18,284 views 0 comments
The question

I am setting up a new CI/CD environment, but I already have another web service running on port 8080. Every time I try to launch Jenkins, I run into a port conflict error. I know Jenkins defaults to 8080, but I need to move it to something like 8081 or 9090. Depending on whether I’m running Jenkins as a standalone .war file, a Windows service, or a Linux systemd service, where are the configuration files located, and which specific environment variable or flag needs to be updated to ensure the change persists after a restart?

3 answers

0
DR
Answered on 05-02-2025

The method for changing the port depends entirely on your installation type.

  • Standalone WAR file: Simply launch it using the --httpPort flag:

    java -jar jenkins.war --httpPort=9090

  • Linux (Systemd): Modern Jenkins installations use systemd overrides. Run sudo systemctl edit jenkins and add:

    Ini, TOML

     

    [Service]
    Environment="JENKINS_PORT=9090"
    
  • Windows Service: Navigate to the Jenkins installation folder and edit the jenkins.xml file. Find the line --httpPort=8080 and change it to your desired port, then restart the Jenkins service through services.msc.

After making these changes, remember to update your firewall rules (like ufw or iptables) to allow traffic on the new port.

0
SA
Answered on 06-02-2025

If I’m running Jenkins inside a Docker container, do I still need to go into the container’s configuration files to change the port, or can I just handle the port mapping during the docker run command?

MA 07-02-2025

Sarah, for Docker, you don't need to change the internal Jenkins config at all! You can simply map a different host port to the container's 8080. Use the -p flag: docker run -p 9090:8080 jenkins/jenkins. Your browser will access Jenkins at localhost:9090, while Jenkins internally still thinks it's on 8080. This is by far the cleanest way to avoid conflicts in a containerized environment.

0
AL
Answered on 08-02-2025

Don't forget to update the Jenkins URL in the system settings! If you change the port but leave the "Jenkins URL" under Manage Jenkins > System pointing to 8080, your email notifications and build links will all be broken.

DR 09-02-2025

I agree with Alex. That’s a classic mistake. I spent an hour debugging why my GitHub webhooks weren't working after a port change, and it was simply because I forgot to update the Global Configuration URL to match the new port.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session