DenCowboy
DenCowboy

Reputation: 15136

Jenkins pipeline using docker on existing slaves

We have the following jenkins setup:

Those are all virtual machines and the slaves do always exist. They don't spawn automatically up and down.

Now we have builds which needs a lot of tools (maven, python, aws cli, ...). We can install every tool on every slave and everything will work fine. But we want to build a docker approach.

Nearly all the tutorials I've seen are using slaves in Docker. They use some orchestration tool like Kubernetes and are creating slaves in Docker, do their stuff and delete the pod again.

We don't have the possibility to do this:

Question: Is it a decent approach to use an 'old' Jenkins setup with real VM slaves on which we use docker?

What I'm thinking about is writing a pipeline and in each stage we use a docker container:

Can someone evaluate this approach?

Upvotes: 5

Views: 3475

Answers (1)

yamenk
yamenk

Reputation: 51896

This is a very good approach. In fact the way to do that is documented under jenkins docs under Using multiple containers section.

In each stage you basically spin up a container with the necessary tools available and you can use a volume to presist output from the stage into the workspace so that other stages can use it.

Upvotes: 2

Related Questions