Docker로 Jenkins를 띄우려고 했는데, 이미 8080 포트를 사용하고 있어 Jenkins 포트 번호를 바꾸고자 했다.
만약 Docker가 아닌 로컬에 Jenkins를 설치했다면 "/etc/default/jenkins" 파일을 수정해야 한다는 정보는 많지만
Docker의 Jenkins 기본 포트를 변경하는 정보는 많지 않았다.
🐳 Jenkins Docker 공식문서
https://hub.docker.com/_/jenkins
jenkins - Official Image | Docker Hub
DEPRECATION NOTICE This image has been deprecated for over 2 years in favor of the jenkins/jenkins:lts image provided and maintained by the Jenkins Community as part of the project's release process. The images found here have not received updates for over
hub.docker.com
Docker의 Jenkins 기본 포트를 변경하려면 JENKINS_OPTS를 활용해야 한다.
처음에 그냥 무작정 7070:7070만 입력했더니 젠킨스 접속이 안 되더라..
docker run -itd --env JENKINS_OPTS=--httpPort=7070 -p 7070:7070 -v ~/jenkins:/var/jenkins_home --name jenkins jenkins/jenkins:lts
JENKINS_OPTS 환경변수에 --httpPort값을 지정해주면 된다!
참고 사이트