Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching a data volume with user id 102 does not work but 1000 does. Update Readme? #25

Closed
mtscout6 opened this issue Oct 9, 2014 · 7 comments

Comments

@mtscout6
Copy link

mtscout6 commented Oct 9, 2014

➜  jenkins-docker git:(master) ✗ make startdata
docker run -d --name jenkins-data mtscout6/jenkins-data echo Data-only container for Jenkins
d85097cd7b7668862159219eeca95ee1a65aaac4ebd4890b301d5e8c9d4af075
➜  jenkins-docker git:(master) ✗ make startserver
docker run -d -p 50000:50000 -p 3010:8080 --name jenkins-server --volumes-from jenkins-data jenkins:1.583
bdade9f59ccad3d77cbddf2fc4c431015ff3a9faad02b1ace065afa75bf59d09
➜  jenkins-docker git:(master) ✗ docker ps -a
CONTAINER ID        IMAGE                          COMMAND                CREATED             STATUS                     PORTS               NAMES
bdade9f59cca        jenkins:1.583                  "/usr/local/bin/jenk   4 seconds ago       Exited (0) 4 seconds ago                       jenkins-server
d85097cd7b76        mtscout6/jenkins-data:latest   "echo Data-only cont   9 seconds ago       Exited (0) 8 seconds ago                       jenkins-data
➜  jenkins-docker git:(master) ✗ docker logs -f jenkins-server
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Oct 09, 2014 3:57:33 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Oct 09, 2014 3:57:33 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Oct 09, 2014 3:57:33 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /var/jenkins_home/war/META-INF/MANIFEST.MF (No such file or directory)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
        at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:277)
        at winstone.HostConfiguration.<init>(HostConfiguration.java:81)
        at winstone.HostGroup.initHost(HostGroup.java:66)
        at winstone.HostGroup.<init>(HostGroup.java:45)
        at winstone.Launcher.<init>(Launcher.java:143)
        at winstone.Launcher.main(Launcher.java:354)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at Main._main(Main.java:293)
        at Main.main(Main.java:98)

The make file I used here can be found at https://github.com/mtscout6/jenkins-docker

@mtscout6
Copy link
Author

mtscout6 commented Oct 9, 2014

Normally I wouldn't want to be on the bleeding edge of jenkins, but I'm trying to use the Docker Plugin to then have dynamic slaves. However, with Docker v1.2.0 I need to have at least jenkins 1.580, but 1.583 is the only tagged version greater than 1.580. (See: jenkinsci/docker-plugin#97)

@mtscout6
Copy link
Author

mtscout6 commented Oct 9, 2014

I should mention that if I do not attach the data volume it works fine. When I ran docker run --rm -it jenkins:1.583 /bin/sh and observed the contents of /var/jenkins_home/ it was empty as I'd expect. So, I'm sure the image is not supplying anything to that directory that the volume would override.

@davidkarlsen
Copy link

You are probably not running the docker container as the same user (-u
) which owns the files in the mounted volume.

2014-10-09 18:15 GMT+02:00 Matt Smith notifications@github.com:

I should mention that if I do not attach the data volume it works fine.
When I ran docker run --rm -it jenkins:1.583 /bin/sh and observed the
contents of /var/jenkins_home/ it was empty as I'd expect. So, I'm sure
the image is not supplying anything to that directory that the volume would
override.


Reply to this email directly or view it on GitHub
#25 (comment)
.

David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

@mtscout6
Copy link
Author

mtscout6 commented Oct 9, 2014

From the readme:

First, ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 102 normally - or use -u root), then:

That is the owner of that volume https://github.com/mtscout6/jenkins-docker/blob/master/jenkins-data/Dockerfile#L5-L7

I should mention that that setup worked fine against 1.565.

@mtscout6
Copy link
Author

mtscout6 commented Oct 9, 2014

I finally found the problem. The uid for the jenkins user is not 102 it's 1000

➜  jenkins-docker git:(master) ✗ docker run --rm -it jenkins:1.583 /bin/sh
$ cat /etc/passwd | grep jenkins
jenkins:x:1000:1000::/var/jenkins_home:/bin/bash

Change uid from 102 -> 1000 and worked like a charm: https://github.com/mtscout6/jenkins-docker/blob/master/jenkins-data/Dockerfile#L5

Is this intentional or should docs get updated, or am I misunderstaning what 102 represents on the readme?

@mtscout6 mtscout6 changed the title Latest 1.583 release does not appear to work when attaching a data volume Attaching a data volume with user id 102 does not work but 1000 does. Update Readme? Oct 15, 2014
@dzuluaga
Copy link

dzuluaga commented Nov 3, 2014

I'm running into a similar error. Without volume -v, it works fine. However, when using volume, it hangs in this entry on the log file:

INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
Nov 03, 2014 2:12:50 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization

Any clues?

@dzuluaga
Copy link

dzuluaga commented Nov 3, 2014

Nevermind, it was just slow, after like 5 minutes it finally started. I wonder why though.

LinuxSuRen pushed a commit to alauda/jenkins-docker that referenced this issue Sep 17, 2020
Fixing #7 - Make group/user customizable via ARG/ENV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants