How to setup docker in Jenkins? - docker

My question is on how to setup docker in jenkins
We have one master server and 5 linux slaves and 2 windows slaves
We are using artifactory to store docker images.
What would be the steps to intergrate docker in jenkins ? Do I need to install docker on linux and windows slaves or any plugin installation required?
There are a lot of plugins: - docker plugin - docker build step plugin - docker pipeline plugin
Which of these can be useful?
I am naive to docker and have no idea on how to proceed with it.

Related

Gitlab-runner installation

I installed gitlab and docker in Ubuntu. Now I need to install gitlab-runner using docker executor. Is it necessary for the gitlab to be running in docker or is it enough if both runs on the same machine?
GitLab Runner is the open source project that is used to run your jobs and send the results back to GitLab. So it just needs connectivity to Gilab and its done by registering the runner. Registering runner
Registering a Runner is the process that binds the Runner with a GitLab instance.
If you want to use Docker, GitLab Runner requires a minimum of Docker v1.13.0.
Allows to run:
Multiple jobs concurrently.
Use multiple tokens with multiple server (even per-project).
Limit number of concurrent jobs per-token.
Jobs can be run:
Locally.
Using Docker containers.
Using Docker containers and executing job over SSH.
Using Docker containers with autoscaling on different clouds and virtualization hypervisors.
Connecting to remote SSH server.
The GitLab Runner version should be in sync with the GitLab version, features may be not available or work properly if there’s a version difference.

Running docker containers as Jenkins Slave

I have Jenkins installed on my system and I want to run docker containers as Jenkins slave.
I am confused with the configuration part of jenkins after installing docker plugin.
What should I enter in those settings?
You'll need to edit Jenkins system configuration (Jenkins > Manage > System configuration) and add a new Cloud of type "Docker"
That means you need to have docker installed in a cloud (a local one like VirtualBox, or a remote one, like Amanzon EC2.
See for instance "Using Docker as a Jenkins Cloud Provider".

Adding Vagrant VM as slave in Jenkins

I'm having ubuntu 16.04 as host machine.
On the top of it, there are 2 Vagrant VMs one acts as Master and another Slave.
On Master, I have Jenkins installed and running
On slave I have Docker installed. I can do Vagrant up and Vagrant ssh and run both machines at the same time.
I need to deploy a .war file which is created in Master VM on to the Docker container which runs on the slave machine. I tried to use syncedfolder option inn Vagrant and Volume in docker. I can copy the war file to webapps directory of docker container by linking those things.
But How do I add the slave Vagrant VM as a slave node in Jenkins which is running on Master VM and deploy to docker container directly from there.
Do I need to have Jenkins installed on slave VM or anything else?
But How do I add the slave Vagrant VM as a slave node in Jenkins which
is running on Master VM and deploy to docker container directly from
there.
Do I need to have Jenkins installed on slave VM or anything else?
Adding a node as a jenkins slave to the master is well documented and you can find the solution here: How to set up new Jenkins slave. Basically, the master needs only to have ssh access and it will install the jenkins slave agent on the node.
Once you have a node registered, you can scheduel builds to run on that node, where you can pretty much do anything. You will have access to all the docker commands via the shell build steps of regular FreeStyle Jobs.

How to run build on docker container in coreos?

I have installed CoreOS as my build environment. I installed Jenkins server as a docker container in CoreOS. And I created a free style project on the Jenkins server to build my project. How can I configure the build run on docker containers on the CoreOS?
So the structure is: CoreOS is my physical machine. Jenkins server is running in a docker container in the CoreOS. And I want to launch more docker containers to run my application. How can I achieve this? The hardest part I think is to launch a docker container in CoreOS from Jenkins JOB. I want to start a new docker container ever time for a build.
I'm not familiar with Jenkins, but I would suggest that you take a look at the docker-machine and docker-compose utilities.
You should be able to have Jenkins use one of those to have the host start your build container.

Jenkins run job in local docker image

Hi I have a Jenkins where I want to run a job in a remote machine using a docker image that I already have on that machine since my cluster does not have any internet access.
I have seen Jenkins docker plugin, but it seems it´s using a docker repository to get the images.
My question is, which is the best Jenkins plugin to acomplish this?. Run a Jenkins job in a docker container using an image in the machine where the job is running?
Regards.

Resources