jenkins-docker

Jenkins concurrent builds on docker slaves

血红的双手。 提交于 2021-02-11 12:11:36
问题 I have a Jenkins Server (2.204.1) with Docker plugin (1.1.9) and a docker cloud API. I work with Jenkins docker agents (slaves) And i map the docker slave build workspace between the container and the host in order to be able to path Artifacts to the downstream jobs. in Jenkins Configuration - Docker Cloud Details - Container settings: Volumes /var/lib/jenkins:/var/lib/jenkins This works fine for a single build , The problem starts when i run concurrent builds, They are all mapped to the same

Jenkins Amazon ECR: no basic auth credentials

本秂侑毒 提交于 2019-12-10 14:51:11
问题 I'm not able to push ocker images to Amazon ECR with Jenkins Pipeline: I always get no basic auth credentials :-( Here is my setup: Jenkins 2.46.2 Amazon ECR plugin 1.4 I've added AWS credentials aws-jenkins to Jenkins (tested locally and successfully pushed to AWS ECR) I've printed /root/.dockercfg to debug auth in my Jenkinsfile Jenkinsfile: stage("Docker") { dir(path) { docker.build("my-image:latest") } docker.withRegistry("https://<my-aws-id>.dkr.ecr.eu-central-1.amazonaws.com", "ecr:eu

jenkins docker plugin in pipeline use -u flag, how is possible to not using

喜夏-厌秋 提交于 2019-12-10 09:57:23
问题 I'm using jenkins version 2.89.1 with docker plugin. In a stage of declarative pipeline I launch a docker container with ansible 2.4.x installed in order to run some playbooks as follow: agent { docker { image 'myself/ansible:1.0.3' registryUrl 'https://my-artifactory-pro' registryCredentialsId 'my-credentials' args '-v /var/lib/jenkins/workspace/myworkspace:/tmp/' + ' -v /var/lib/jenkins/.ssh:/root/.ssh' } } steps { echo 'Deploying Ansible Server via docker image' sh "ansible-playbook -i

How to find “Docker Host URI” to be used in Jenkins “Docker Plugin”?

天涯浪子 提交于 2019-12-10 03:47:01
问题 Is there any command which we can run and find out the "Docker Host URI"? I found some of related questions but didn't get it exactly. 回答1: Yes this is the docker host uri tcp://127.0.0.1:2375 But before that you need to add this DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock" In /etc/default/docker at the end of file, then restart the docker.onec restarted docker.sock will run in 2375 and add this tcp://127.0.0.1:2375 in Jenkins 回答2: The other option would be to enter

Unable to start container from jenkins

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:10:23
问题 In Jenkins I installed Docker build step plugin. In Jenkins, created job and in it, executed docker command selected build image. The image is created using the Dockerfile.The Dockerfile is : FROM ubuntu:latest #OS Update RUN apt-get update RUN apt-get -y install git git-core unzip python-pip make wget build-essential python-dev libpcre3 libpcre3-dev libssl-dev vim nano net-tools iputils-ping supervisor curl supervisor WORKDIR /home/wipro #Mongo Setup RUN curl -O http://downloads.mongodb.org

Template docker agent in jenkins Declarative pipeline

[亡魂溺海] 提交于 2019-12-07 18:04:49
问题 I have a Jenkinsfile for a declarative pipeline that uses docker agents. A number of the steps use a docker agent and it is a bit repetitive adding the same agent for these steps e.g. pipeline { agent any stages { stage('Stage 1') { steps { //Do something } } stage('Stage 2') { agent { docker { image 'jenkins/jenkins-slave:latest' reuseNode true registryUrl 'https://some.registry/' registryCredentialsId 'git' args '-v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -e HOME=${WORKSPACE}' } }

Running Jenkins tests in Docker containers build from dockerfile in codebase

房东的猫 提交于 2019-12-06 21:27:06
问题 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,

Unable to start container from jenkins

空扰寡人 提交于 2019-12-06 15:06:54
In Jenkins I installed Docker build step plugin. In Jenkins, created job and in it, executed docker command selected build image. The image is created using the Dockerfile.The Dockerfile is : FROM ubuntu:latest #OS Update RUN apt-get update RUN apt-get -y install git git-core unzip python-pip make wget build-essential python-dev libpcre3 libpcre3-dev libssl-dev vim nano net-tools iputils-ping supervisor curl supervisor WORKDIR /home/wipro #Mongo Setup RUN curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.0.2.tgz && tar -xzvf mongodb-linux-x86_64-3.0.2.tgz && cd mongodb-linux

Template docker agent in jenkins Declarative pipeline

亡梦爱人 提交于 2019-12-05 22:44:14
I have a Jenkinsfile for a declarative pipeline that uses docker agents. A number of the steps use a docker agent and it is a bit repetitive adding the same agent for these steps e.g. pipeline { agent any stages { stage('Stage 1') { steps { //Do something } } stage('Stage 2') { agent { docker { image 'jenkins/jenkins-slave:latest' reuseNode true registryUrl 'https://some.registry/' registryCredentialsId 'git' args '-v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -e HOME=${WORKSPACE}' } } steps { //Do something } } stage('Stage 3') { steps { //Do something } } stage('Stage 4') { agent {