简体   繁体   中英

Jenkins Docker throwing exception and starting offline

I'm trying to get Jenkins up and running in Docker. I'm using the official repo and pulling the latest tag.

docker run -u 498 --name awsjenkins -p 8080:8080 -p 50000:50000 -v /mnt/jenkins:/var/jenkins_home jenkins

It starts okay, but it's throwing an error:

Apr 26, 2017 9:14:27 PM hudson.model.UpdateCenter updateDefaultSite
WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.io.IOException: Server returned HTTP response code: 503 for URL: http://updates.jenkins-ci.org/update-center.json?id=default&version=2.46.2
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at hudson.model.DownloadService.loadJSON(DownloadService.java:172)
    at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:190)
    at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2197)
    at jenkins.install.SetupWizard.init(SetupWizard.java:174)
    at jenkins.install.InstallState$3.initializeState(InstallState.java:105)
    at jenkins.model.Jenkins.setInstallState(Jenkins.java:1061)
    at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:96)
    at jenkins.model.Jenkins.<init>(Jenkins.java:951)
    at hudson.model.Hudson.<init>(Hudson.java:86)
    at hudson.model.Hudson.<init>(Hudson.java:82)
    at hudson.WebAppMain$3.run(WebAppMain.java:231)

A curl -L to that URL from the host machine returns a 301, so I don't think it's a firewall issue...

I am running this on Amazon, but I don't think that would cause any issues. I even opened up the security groups completely just for kicks, but I'm still getting this error. Also, I can access Jenkins. But when I do, it tells me that Jenkins is running offline.

Any thoughts on this?

Well, hopefully this helps someone else out... Thanks to Andy's comment, I was able to figure it out.

There's a few things going on here.

  1. The official Dockerfile defaults to using 1000 for both the uid and gid. But really, 1000 is typically occupied by a candidate in the host OS. Personally, I think it should be changed to something a bit more obscure. Just my $.02...
  2. When overriding the uid , it doesn't actually create the group. In Jenkins official documentation on Docker Hub, it says:

Ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 1000) or use -u some_other_user parameter with docker run .

The fix is pretty simple - pull the Dockerfile, modify it to work with your local user and uid/gid (there are several ways to do this), and build/run it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM