jenkins-docker

Running Jenkins tests in Docker containers build from dockerfile in codebase

本秂侑毒 提交于 2019-12-05 01:46:51
I want to deploy a continuous integration platform based on Jenkins. As I have various kinds of projects (PHP / Symfony, node, angular, …) and as I want these tests to run both locally and on Jenkins, I was thinking about using Dockers containers. The process I’m aiming for is : A merge request is opened on Github / Gitlab A webhook notifies Jenkins of the merge request Jenkins pulls the repo, builds the containers and runs a shell script to execute the tests Once the tests are finished, Jenkins retrieves the results from one of the containers (through a shared volume) and process the results.

Changing the user's uid in a pre-build docker container (jenkins)

拟墨画扇 提交于 2019-12-04 18:25:46
问题 I am new to docker, so if this is a fairly obvious process that I am missing, I do apologize for the dumb question up front. I am setting up a continuous integration server using the jenkins docker image. I did a docker pull jenkins , and created a user jenkins to allow me to mount the /var/jenkins_home in the container to my host's /var/jenkins_home (also owned by jenkins:jenkins user). the problem is that the container seems to define the jenkins user with uid 102, but my host has the

How do I stop a running container in Jenkinsfile?

a 夏天 提交于 2019-12-03 13:55:59
问题 I have a Jenkinsfile or a Jenkins pipeline which creates a new image and starts a container out of that image. It works well for the first time. But on subsequent runs, I want the previous container to be stopped and removed. My Jenkinsfile is as follows: node { def commit_id stage('Preparation') { checkout scm sh "git rev-parse --short HEAD > .git/commit-id" commit_id = readFile('.git/commit-id').trim() } stage('docker build/push') { docker.withRegistry('https://index.docker.io/v1/',

How do I stop a running container in Jenkinsfile?

…衆ロ難τιáo~ 提交于 2019-12-03 04:51:29
I have a Jenkinsfile or a Jenkins pipeline which creates a new image and starts a container out of that image. It works well for the first time. But on subsequent runs, I want the previous container to be stopped and removed. My Jenkinsfile is as follows: node { def commit_id stage('Preparation') { checkout scm sh "git rev-parse --short HEAD > .git/commit-id" commit_id = readFile('.git/commit-id').trim() } stage('docker build/push') { docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') { def app = docker.build("my-docker-id/my-api:${commit_id}", '.').push() } } stage('docker stop

How to mount docker socket as volume in docker container with correct group

大城市里の小女人 提交于 2019-12-03 04:16:52
问题 I want to run a Jenkins instance in a docker container. I want Jenkins itself to be able to spin up docker containers as slaves to run tests in. It seems the best way to do this is to use docker run -v /var/run.docker.sock:/var/run/docker.sock -p 8080:8080 -ti my-jenkins-image source The Dockerfile I'm using is FROM jenkins COPY plugins.txt /usr/share/jenkins/plugins.txt RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt USER root RUN apt-get update && apt-get install -y docker.io

How to mount docker socket as volume in docker container with correct group

…衆ロ難τιáo~ 提交于 2019-12-02 18:10:19
I want to run a Jenkins instance in a docker container. I want Jenkins itself to be able to spin up docker containers as slaves to run tests in. It seems the best way to do this is to use docker run -v /var/run.docker.sock:/var/run/docker.sock -p 8080:8080 -ti my-jenkins-image source The Dockerfile I'm using is FROM jenkins COPY plugins.txt /usr/share/jenkins/plugins.txt RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt USER root RUN apt-get update && apt-get install -y docker.io RUN usermod -aG docker jenkins USER jenkins If I start a bash session in my running container and run