Questions tagged [jenkins-docker]
110 questions
4
votes
2 answers
How do I stop a running container in Jenkinsfile?
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…

vijayst
- 20,359
- 18
- 69
- 113
4
votes
1 answer
jenkins docker plugin in pipeline use -u flag, how is possible to not using
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…

MarMac
- 41
- 4
4
votes
0 answers
jenkins-docker cannot set the cloud credentials
I am trying to set up the jenkins-docker plugin to run using a Rancher system. To start a docker container requires using the rancher api and a username/password authentication.
In the "Jenkins Configuration" page under the "cloud" section, there…

richard
- 2,887
- 5
- 26
- 36
4
votes
0 answers
Docker container has trouble mounting volume with Jenkins
I use the Jenkins Docker plugin to build my image (this works), I can run the container just fine with a command like
docker run test-env:latest /etc/bootstrap.sh -jenkins
However, when I run
docker run -u root -v $WORKSPACE:/test…

Gabe Cohen
- 85
- 7
3
votes
1 answer
Jenkins build agent docker specify docker file name
I was following this snippet to add to docker file for jenkins build agent (https://www.jenkins.io/doc/book/pipeline/docker/),
pipeline {
agent { dockerfile true }
stages {
stage('Test') {
steps {
sh 'node --version'
…

Vijayanath Viswanathan
- 8,027
- 3
- 25
- 43
3
votes
1 answer
Certificate issue for launching kubernetes pods for Jenkins (hosted outside of that kubernetes cluster)
I have been trying to configure jenkins kubernetes cloud agents on my existing jenkins setup (which is hosted outside k8s cluster).
My jenkins is hosted in Google Cloud Platform in a Windows VM. It is exposed to internet and we have a ssl…

ashkaps
- 61
- 6
3
votes
0 answers
How to persist build directory in workspace while using docker-container as a jenkins build agent?
I am using docker containers as Jenkins build agents. All build agents, jenkins master node are docker containers running on same host. (no different vms)
Following is the Docker Agent template I am using to build an angular app.
These are Docker…

Sachin Giri
- 189
- 11
3
votes
1 answer
Gradle docker container ignores cache when started from Jenkinsfile
I am running a build in a gradle container with a volume for the cache, but gradle does not make use of the downloaded dependencies in the cache for the subsequent builds.
Here's the dockerfile for the gradle image:
FROM **custom image base**
#…

Oromë
- 199
- 2
- 16
3
votes
2 answers
Jenkins with Docker plugin java.lang.NullPointerException: uri was not specified
I'm trying to use the Docker plugin with Jenkins. But Jenkins cannot access the REST API.
In the Jenkins configuration I put the Docker REST URL: http://127.0.0.1:4243 and when clicking on test connection it gives me Something went wrong, cannot…

Syex
- 1,320
- 1
- 12
- 23
2
votes
1 answer
Docker image retag for build promotion
I am trying to promote a docker image in my Jenkins pipeline using Jenkins docker plugin but I am able to do so as I am getting following error.
"docker tag" requires exactly 2 arguments.
See 'docker tag --help'.
Usage: docker tag…

niklodeon
- 1,320
- 5
- 20
- 51
2
votes
2 answers
Jenkins scripted pipeline with sidecar MYSQL container for testing
I have the below pipeline that would run the actual container along side with MYSQL container to run test.
stage('Test - To check MYSQL connect') {
def dockerfile = 'Dockerfile.test'
def mysql = docker.image('mysql:5.6').run('-e…

epynic
- 1,124
- 2
- 14
- 26
2
votes
0 answers
Get mapped ports of Jenkins docker slaves as pipeline parameters
We want to switch to a new Jenkins (ver. 2.176.1), where the slaves are started in a docker cloud on demand (using the docker plugin).
How to start an agent in the cloud, with a specific port mapping, which does not collide with other containers in…

gregor
- 63
- 6
2
votes
0 answers
Jenkins Docker EC2 Plugin Parallel Jobs
We have Jenkins configured on AWS based primarily on the setup described here.
As part of that configuration, we are using the Amazon EC2 Container Service Plugin to provision build agents on demand. At the surface, this seems to be working…

Nader Hendawi
- 375
- 1
- 7
- 17
2
votes
1 answer
Build with Docker in a Jenkins shared library
I am trying to define Jenkins pipelines as (shared) objects, as done here. But I want to add the capability to run build actions inside a docker container.
My Jenkinsfile works like this:
@Library('ci-scons-jenkins') _
def image =…

Natxo.Piq
- 105
- 2
- 9
2
votes
0 answers
Jenkins: Permission issue using Docker as build environment
I installed Jenkins on an Ubuntu 16.04 machine. The Jenkins itself is not run in a container. What I want to do is simply call yarn install using a node image. So here is my Jenkinsfile:
pipeline {
agent any
stages {
stage('install…

Michael
- 2,075
- 7
- 32
- 46