Done after having looked 

So, this now works:

pipeline {

    agent {
        dockerfile {
            label "docker"

    // ...

In order to restrict the data sent to the Docker daemon, I also declare a 
.dockerignore file which contains only:


This way, only the Dockerfile itself is sent to the build context for the 

Best regards,

On Wednesday, 15 February 2017 21:30:16 UTC+1, Damien Coraboeuf wrote:
> Hi,
> I'm starting to migrate some projects to the declarative pipeline model. 
> In particular, we want to build on an agent designated by the "docker" 
> label (which runs a Docker daemon) and then, I want to build inside a 
> Docker container described by my Dockerfile.
> Doing this:
> pipeline {
>    agent {
>      label "docker"
>      dockerfile true
>    }
> }
> This generates an error:
> Only one agent type is allowed per agent section
> Now, what should be the best approach to solve this, I think, common 
> pattern?
> I will try using agent+label, and then using docker+build+inside in steps, 
> but would not it more elegant to allow to use both a label and a Dockerfile 
> in the agent declaration?
> Thanks you for any feedback,
> Damien.

You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit
For more options, visit

Reply via email to