Jenkins官方镜像,初始化后无法安装插件问题
作者:互联网
建议使用Jenkins中文社区提供的jenkins镜像
jenkins的中文社区官网:https://www.jenkins.io/zh
镜像拉取地址
docker pull jenkinszh/jenkins-zh:2.267
设置挂载jenkins目录
mkdir /home/jenkins_home
chmod -R 777 /home/jenkins_home
启动容器
docker run -d -p 8080:8080 -p 50000:50000 --name jenkins-zh -v /home/jenkins_home:/var/jenkins_home jenkinszh/jenkins-zh:2.267
CentOS 安装 docker | Server 运维论坛 (learnku.com)
第二种方法:建议使用tomcat进行自定义构建镜像
-
删除里面多与的内容
docker run -itd --name tomcat-test ccr.ccs.tencentyun.com/wego-prod/tomcat9-jdk8:v2.0 docker exec -it tomcat-test bash 删除多余的内容,如日记等信息
-
构建底层基础镜像
docker commit -a "wanglinhao" -m "这是一个没有日志的tomcat镜像" 83eaf978cdb6 ccr.ccs.tencentyun.com/wego-prod/tomcat9-jdk8:wanglinhao docker push ccr.ccs.tencentyun.com/wego-prod/tomcat9-jdk8:wanglinhao
-
编写dockerfile
FROM ccr.ccs.tencentyun.com/wego-prod/tomcat9-jdk8:wanglinhao COPY ./jenkins-2.333.war /usr/local/tomcat/webapps/ROOT.war #ENV JAVA_HOME /var/jdk1.8.0_121 #ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin ENV JENKINS_HOME /var/jenkins_home # 安装git RUN echo > /etc/apt/sources.list \ && echo "deb http://mirrors.163.com/debian stretch main" >> /etc/apt/sources.list \ && echo "deb http://mirrors.163.com/debian stretch-updates main" >> /etc/apt/sources.list \ && apt-get update \ && apt-get install git-all -y CMD ["/usr/local/tomcat/bin/run.sh"]
-
构建镜像,下载war包
docker build -t ccr.ccs.tencentyun.com/wego/jenkins:zh-2.333 . docker push ccr.ccs.tencentyun.com/wego/jenkins:zh-2.333
-
最后启动
-
通过war包启动的日志,初始密码位置
cat /root/.jenkins/secrets/initialAdminPassword
标签:初始化,插件,home,jenkins,Jenkins,docker,tencentyun,com,wego 来源: https://www.cnblogs.com/moniter/p/jenkins-guan-fang-jing-xiang-chu-shi-hua-hou-wu-fa.html