Since you're adding the configuration in your Dockerfile, it should be there when the docker image is created. Since you can see it for the first few seconds in the running image, I think that means the jenkins.sh startup process which copies from "ref" to "/var/jenkins_home" did what it was expected to do (though there is a risk you're seeing it before jenkins.sh copies in the file from ref/config.xml).
Since a change is happening after jenkins.sh has copied the ref content into the runtime location, I assume it must be something other than the jenkins.sh startup process which is replacing your modified ref/config.xml file with a different config.xml file. However, I don't know of anything after that which could make that type of change. Are you entirely sure that the modified file is in the /var/jenkins_home directory even after the jenkins.sh script has run? I regularly use a modified config.xml to configure a Jenkins Docker instance, and it has worked quite well for me. If you'd like to compare how mine is configured, you could look at https://github.com/MarkEWaite/docker/blob/lts-with-plugins/ref/config.xml . Thanks, Mark Waite On Mon, Dec 19, 2016 at 12:27 AM Stefan Rademacher <rademacher...@gmail.com> wrote: > Hi there, > > I am currently working on a Docker image, that is derived from > jenkins:alpine. > In my Dockerfile I copy a config.xml in the the reference content > directory (/usr/share/jenkins/ref) and add some xml content with > Ansible-XML. (The content added, is a cloud configuration for a Docker host) > > After starting my container, I can see my config.xml in /var/jenkins_home > for a couple of seconds. > After that, it is overwritten with a default config.xml. This seems to > happen, some time during the start of the server. The problem cannot even > be solved by using the filename config.xml.override, as suggested in the > docs of the official docker image. > > Weirdly, I can’t reproduce this error, when I start Jenkins without > docker. In that case, my custom config.xml is kept as is on the first start > of Jenkins. > > In Jenkins.java ( > https://github.com/jenkinsci/jenkins/blob/3e2e01717976a1f1221874bfd576429c5c48b8a6/core/src/main/java/jenkins/model/Jenkins.java#L3015) > I can’t find anything, that explains the overwriting of my config.xml. > > Does anyone have an idea, why this happens? > > Thanks and best regards > Stefan Rademacher > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/3CA43885-85DD-4530-9FC8-9F2465F949FD%40gmail.com > <https://groups.google.com/d/msgid/jenkinsci-users/3CA43885-85DD-4530-9FC8-9F2465F949FD%40gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHi4pa7sHqPBZOam1DHsjacb2GLYpPE5kGmuq9nGOwu6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.