jenkinsci / docker

Docker official jenkins repo
https://hub.docker.com/r/jenkins/jenkins
MIT License
6.66k stars 4.52k forks source link

With Jenkins Ver.2.x, when run commited Docker Image, it starts from SetupWizard. #298

Closed nobusugi246 closed 8 years ago

nobusugi246 commented 8 years ago
  1. docker run --name jenkins -d -p 8081:8080 -p 50001:50000 jenkinsci/jenkins:2.10
  2. http://192.168.99.100:8081/ by browser, install plugins, create First Admin User, then logout.
  3. docker commit jenkins jenkins_configured:2.10
  4. docker stop jenkins
  5. docker run -d -p 8081:8080 -p 50001:50000 jenkins_configured:2.10
  6. http://192.168.99.100:8081/ by browser, "Getting Started" page was displayed. I expect to start from user login.

This is docker logs of jenkins_configured:2.10.

Running from: /usr/share/jenkins/jenkins.war webroot: EnvVars.masterEnvVars.get("JENKINS_HOME") Jun 25, 2016 6:23:30 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Logging initialized @454ms Jun 25, 2016 6:23:30 AM winstone.Logger logInternal INFO: Beginning extraction from war file Jun 25, 2016 6:23:31 AM org.eclipse.jetty.util.log.JavaUtilLog warn WARNING: Empty contextPath Jun 25, 2016 6:23:31 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: jetty-9.2.z-SNAPSHOT Jun 25, 2016 6:23:32 AM 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") Jun 25, 2016 6:23:33 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started w.@7be58f16{/,file:/var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war} Jun 25, 2016 6:23:33 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started ServerConnector@150ab4ed{HTTP/1.1}{0.0.0.0:8080} Jun 25, 2016 6:23:33 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started @3279ms Jun 25, 2016 6:23:33 AM winstone.Logger logInternal INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled Jun 25, 2016 6:23:33 AM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Jun 25, 2016 6:23:33 AM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Jun 25, 2016 6:23:35 AM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Jun 25, 2016 6:23:35 AM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Jun 25, 2016 6:23:35 AM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Jun 25, 2016 6:23:37 AM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Jun 25, 2016 6:23:37 AM hudson.model.AsyncPeriodicWork$1 run INFO: Started Download metadata Jun 25, 2016 6:23:37 AM jenkins.util.groovy.GroovyHookScript execute INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy Jun 25, 2016 6:23:37 AM org.jenkinsci.main.modules.sshd.SSHD start INFO: Started SSHD at port 43671 Jun 25, 2016 6:23:38 AM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Jun 25, 2016 6:23:38 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@4bb69a15: display name [Root WebApplicationContext]; startup date [Sat Jun 25 06:23:38 UTC 2016]; root of context hierarchy Jun 25, 2016 6:23:38 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@4bb69a15]: org.springframework.beans.factory.support.DefaultListableBeanFactory@34491cfe Jun 25, 2016 6:23:38 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@34491cfe: defining beans [authenticationManager]; root of factory hierarchy Jun 25, 2016 6:23:38 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@332f0116: display name [Root WebApplicationContext]; startup date [Sat Jun 25 06:23:38 UTC 2016]; root of context hierarchy Jun 25, 2016 6:23:38 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@332f0116]: org.springframework.beans.factory.support.DefaultListableBeanFactory@44ac15b9 Jun 25, 2016 6:23:38 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@44ac15b9: defining beans [filter,legacy]; root of factory hierarchy Jun 25, 2016 6:23:39 AM 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:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword



Jun 25, 2016 6:23:40 AM hudson.model.UpdateSite updateData INFO: Obtained the latest update center data file for UpdateSource default Jun 25, 2016 6:23:41 AM hudson.model.DownloadService$Downloadable load INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller Jun 25, 2016 6:23:42 AM hudson.model.UpdateSite updateData INFO: Obtained the latest update center data file for UpdateSource default Jun 25, 2016 6:23:42 AM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running Jun 25, 2016 6:23:43 AM hudson.model.DownloadService$Downloadable load INFO: Obtained the updated data file for hudson.tools.JDKInstaller Jun 25, 2016 6:23:43 AM hudson.model.AsyncPeriodicWork$1 run INFO: Finished Download metadata. 5,986 ms --> setting agent port for jnlp --> setting agent port for jnlp... done

OS X 10.11.5, Docker version 1.11.1, build 5604cbe Best Regards.

dweomer commented 8 years ago

Jenkins persists all state to a volume declared in the Dockerfile. Writes to volumes are not persisted in images, which is what a commit creates.

gotgenes commented 8 years ago

Could this be solved by removing the declaration /var/jenkins_home as a volume?

This being said, mounting /var/jenkins_home as a volume should be strongly recommended for data persistence beyond the lifespan of a single container. The use of docker commit to persist data and configuration should be considered a Docker anti-pattern.

nobusugi246 commented 8 years ago

@dweomer Thank you. I got it. @gotgenes I think removing the declaration /var/jenkins_home as a volume will solve this. This is a spec of Docker.

carlossg commented 8 years ago

As @dweomer said, changes to the volume are not persisted, and commit is an anti-pattern