之前搭建过好多次jekens,但是最后由于各种原因,还是有各种小问题,今天终于搭建成功了。下面分享一下搭建步骤
我之前切换的是阿里的镜像源,为了安装jekens 切换网易的数据源
新版的 Docker 使用 /etc/docker/daemon.json(Linux)
vim /etc/docker/daemon.json
请在该配置文件中加入(没有该文件的话,请先建一个):
{
“registry-mirrors”: [“http://hub-mirror.c.163.com“]
}
生成docker容器
docker run --name jenkins -p 8080:8080 -p 50000:50000 -v /data/jenkins:/var/jenkins_home -it -d jenkins:alpine
docker logs jenkins
touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
原来是jenkins的目录的权限不够,于是对目录进行授权,然后重启
chmod -R 777 /data/jenkins
docker restart jenkins
执行 docker logs jenkins 日志如下
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Nov 27, 2018 1:58:24 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Nov 27, 2018 1:58:25 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized @768ms
Nov 27, 2018 1:58:25 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Nov 27, 2018 1:58:26 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
Nov 27, 2018 1:58:26 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-9.2.z-SNAPSHOT
Nov 27, 2018 1:58:28 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
Nov 27, 2018 1:58:30 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started w.@6e1d8f9e{/,file:/var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
Nov 27, 2018 1:58:30 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started ServerConnector@7829b776{HTTP/1.1}{0.0.0.0:8080}
Nov 27, 2018 1:58:30 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started @5903ms
Nov 27, 2018 1:58:30 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
Nov 27, 2018 1:58:31 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Nov 27, 2018 1:58:31 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Nov 27, 2018 1:58:33 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Nov 27, 2018 1:58:33 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Nov 27, 2018 1:58:33 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Nov 27, 2018 1:58:36 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Nov 27, 2018 1:58:36 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Started Download metadata
Nov 27, 2018 1:58:36 PM jenkins.util.groovy.GroovyHookScript execute
INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy
Nov 27, 2018 1:58:37 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Nov 27, 2018 1:58:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@296b97b2: display name [Root WebApplicationContext]; startup date [Tue Nov 27 13:58:38 GMT 2018]; root of context hierarchy
Nov 27, 2018 1:58:38 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@296b97b2]: org.springframework.beans.factory.support.DefaultListableBeanFactory@25711f2e
Nov 27, 2018 1:58:38 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@25711f2e: defining beans [authenticationManager]; root of factory hierarchy
Nov 27, 2018 1:58:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@1fc612ab: display name [Root WebApplicationContext]; startup date [Tue Nov 27 13:58:38 GMT 2018]; root of context hierarchy
Nov 27, 2018 1:58:38 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@1fc612ab]: org.springframework.beans.factory.support.DefaultListableBeanFactory@a321c0d
Nov 27, 2018 1:58:38 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@a321c0d: defining beans [filter,legacy]; root of factory hierarchy
Nov 27, 2018 1:58:39 PM jenkins.install.SetupWizard init
INFO:
*************************************************************
*************************************************************
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
b72d366c0f9f4d04973fae4847d7a981
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************