configuration-as-code-plugin/demos/docker
Oleg Nenashev 35d7025dc8
Update the Docker plugin demo to use the "jenkins/agent" image instead of the deprecated one (#1464)
* Update the Docker plugin demo to use the "jenkins/agent" image instead of the deprecated one

* Add a production use note

* Update DockerCloudTest.java
2020-11-02 12:29:26 +01:00
..
README.md Update the Docker plugin demo to use the "jenkins/agent" image instead of the deprecated one (#1464) 2020-11-02 12:29:26 +01:00

README.md

Configure docker plugin

Basic configuration of the Docker plugin

For plugin version 1.1.2 and up:

sample configuration

jenkins:
  clouds:
    - docker:
        name: "docker"
        dockerApi:
          dockerHost:
            uri: "unix:///var/run/docker.sock"
        templates:
          - labelString: "docker-agent"
            dockerTemplateBase:
              # TODO: pin sha256 or versions when using in production
              image: "jenkins/agent"
              volumes:
                - hello:/hello
                - world:/world
              environmentsString: |
                hello=world
                foo=bar                
            remoteFs: "/home/jenkins/agent"
            connector:
              attach:
                user: "jenkins"
            instanceCapStr: "10"
            retentionStrategy:
              idleMinutes: 1

implementation note

Jenkins singleton doesn't offer any setClouds method. So here we rely on a pseudo-property implemented by a dedicated Attribute to add the configured clouds to Jenkins.clouds. The current implementation only adds the configured cloud if it doesn't exists yet.