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".
Related
I installed Jenkins on AWS and installed dockerhub on my local machine. When i created a pipeline job in Jenkins and build then I got an error in last build stage.
https://github.com/Raahatx8/docker
I used above repo to create my pipeline, it includes dockefile and jenkinsfile.
This is the error
Your remote machine i.e. AWS doesn't have connection to the Docker daemon (which is in the local machine) to run the docker commands.
In order to achieve the same i.e. to run the docker commands, you need to do two things:
Enable Docker Remote API (in your local machine where docker is installed)
Download docker client (in AWS machine)
Refer to guide: https://gist.github.com/kekru/4e6d49b4290a4eebc7b597c07eaf61f2
Note: Make sure you need to open connection to particular port in local machine, so that AWS machine can connect.
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.
I have a ec2 instance running as my jenkins master. I would like to run a container in that instance that will be used as another build executor so I can tun a few builds simultaneously.
Im having pronblems connecting these.
In the docker hub jenkins docs it says under the relevant section:
You can run builds on the master out of the box.
But if you want to attach build slave servers through JNLP (Java Web
Start): make sure you map the port: -p 50000:50000 - which will be
used when you connect a slave agent.
If you are only using SSH slaves, then you do NOT need to put that
port mapping.
but when I try to add a node in the jenkins config, it asks remote root directory (probably should be /var/jenkins ? ) and a launch method.
I don't quite understand what I should give it as its launch method to make this work and I don't understand where the port number comes into play.
What you need is Jenkins Docker plugin (link below) and follow the instructions listed here
https://wiki.jenkins.io/display/JENKINS/Docker+Plugin
I followed those instructions and was able to setup dynamic slaves in Jenkins which are dynamically provisioned.
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.
I have to run some jobs from a website.
Jenkins is the best solution for it.
But we have to run the jobs on the users machine with the users id.
For this we need to add users linux machine as slave or Is there any plugin through which we can do ssh on users machine and do all the processes?
I thought of using swarm plugin but swarm dependencies jar need to be run from the user's machine. Again we need to do ssh on user's machine to run the jar.
See the SSH plugin:
This Plugin was derived from the very cool SCP Plugin.
You can use the SSH Plugin to run shell commands on a remote machine via ssh.