2
votes

I am trying to get jenkins running inside docker using marathon and mesos to lunch a jenkins docker image.

I used the create application button which produces the following json

{
  "type": "DOCKER",
  "volumes": [
    {
      "containerPath": "/var/jenkins_home",
      "hostPath": "jenkins_home",
      "mode": "RW"
    },
    {
      "containerPath": "jenkins_home",
      "mode": "RW",
      "persistent": {
        "size": 200
      }
    }
  ],
  "docker": {
    "image": "jenkins",
    "network": "HOST",
    "privileged": false,
    "parameters": [],
    "forcePullImage": false
    }
}

stdout shows

--container="mesos-c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0.ac0b4dbb-10e4-4684-a4df-9539258d77ee" --docker="docker" --docker_socket="/var/run/docker.sock" --help="false" --initialize_driver_logging="true" --launcher_dir="/home/ajazam/mesos-0.28.0/build/src" --logbufsecs="0" --logging_level="INFO" --mapped_directory="/mnt/mesos/sandbox" --quiet="false" --sandbox_directory="/var/lib/mesos/data/slaves/c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0/frameworks/6079a596-90a8-4fa5-9c92-9215558737d1-0000/executors/jenkins-t7.9be44260-f99c-11e5-b0ac-e4115bb26fcc/runs/ac0b4dbb-10e4-4684-a4df-9539258d77ee" --stop_timeout="0ns"
Registered docker executor on slave4
Starting task jenkins-t7.9be44260-f99c-11e5-b0ac-e4115bb26fcc
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?

stderr shows

I0403 14:04:51.026866  6569 exec.cpp:143] Version: 0.28.0
I0403 14:04:51.032097  6585 exec.cpp:217] Executor registered on slave c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission denied

I am using

marathon 1.0.0 RC1 mesos 0.28.0

docker 1.10.3

OS is ubuntu 14.04.4 LTS

Does anybody have any pointers to where I'm going wrong? My feeling is that the problem is todo with the persistent volume and the mapping of it into the jenkins container.

1
What are the permissions on the agent's /var/jenkins_home folder? - Tobi
I've just corrected a mistake in host_path. It was jenkins_path but should have said jenkins_home. I have made the correction. However the two container path references do not match. I'll alter those when I get home so they match. - Abdul Jabbar Azam

1 Answers

0
votes

I got it working. git clone https://github.com/jenkinsci/docker.git on to your agent nodes. I've done it on all mine

insert # in front of lines 16 and 17 in Dockerfile e.g

#    RUN groupadd -g ${gid} ${group} \
#        && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}

run sudo docker build . use sudo docker tag xyz jenkins to rename the repo to jenkins and then create an application using docker, jenkins and persistent volumes.