qacwnfq q
qacwnfq q

Reputation: 345

What are the advantages of running Jenkins in a docker container

I've found quite a few blogs on how to run your Jenkins in Docker but none really explain the advantages of doing it.

These are the only reasons I found:reasons to use Docker.

1) I want most of the configuration for the server to be under version control.

2) I want the ability to run the build server locally on my machine when I’m experimenting with new features or configurations

3) I want to easily be able to set up a build server in a new environment (e.g. on a local server, or in a cloud environment such as AWS)

Luckily I have people who take care of my Jenkins server for me so these points don't matter as much. Are these the only reasons or are there better arguments I'm overlooking, like automated scaling and load balancing when many builds are triggered at once (I assume this would be possible with Docker)?

Upvotes: 19

Views: 16306

Answers (2)

Dirc
Dirc

Reputation: 426

Jenkins as Code

You list mainly the advantages of having "Jenkins as Code". Which is a very powerfull setup indeed, but does not necessary requires Docker.

So why is Docker the best choice for a Jenkins as Code setup?

Docker

The main reason is that Jenkins pipelines work really well with Docker. Without Docker you need to install additional tools and add different agents to Jenkins. With Docker,

  • there is no need to install additional tools, you just use images of these tools. Jenkins will download them from internet for you (Docker Hub).
  • For each stage in the pipeline you can use a different image (i.e. tool). Essentially you get "micro Jenkins agents" which only exists temporary. Hence you do not need fixed agents anymore. This makes your Jenkins setup much more clean.

Getting started

A while ago I have written an small blog on how to get started with Jenkins and Docker, i.e. create a Jenkins image for development which you can launch and destroy in seconds.

Upvotes: 5

Shihe Zhang
Shihe Zhang

Reputation: 2771

This answer for Docker, what is it and what is the purpose covered What is docker? and Why docker? Docker official site also provides an explanation.
The simple guide here is:

Faster delivery of your applications
Deploy and scale more easily
Get higher density and run more workloads
Faster deployment makes for easier management

For Jenkins usage, it's faster and easier to deploy/install in the docker way. Maybe you don't need the scale more easily feature right now. And since the docker is quite lightweight, so you can run more workloads.

However

The docker way would also bring some other problem. Generally speaking, it's the accessing privilege.
Like when you need to run Docker inside the Jenkins(in Docker), it would become complicated somehow. This blog would provide you with some knowledge of that situation.

So there is no silver bullet as always. There is no single development, in either technology or in management technique, that by itself promises even one order-of-magnitude improvement in productivity, in reliability, in simplicity.

The choice should be made based on the specific scenario.

Upvotes: 7

Related Questions