Hello,
I recently switched to running Jenkins from host machine to a docker container (https://hub.docker.com/r/jenkins/jenkins). I was also using docker agents to build. This is now broken in my current setup as I'm spinning up a slave container to run pipelines and issues arise in a situation such as:

pipeline {
    agent { label 'jnlp-agent-docker' }
    // this is the major change as before it was not a container,
    // the label refers to a template with a similar version of
    // https://github.com/jenkinsci/jnlp-agents/ > docker
    stages {
        stage('Build') {
            agent {
                docker { // could also be dockerfile
                    image "<myimage>"
                }
            }
            steps {
                git 'myrepo'
                sh "build"
                archiveArtifacts artifacts: 'dist/**/*'
            }
        }
    }
}

The docker plugin (this one > http://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin) is obviously unable to mount workspaces in another container and builds fail. I would like to avoid adding a new template for this and using docker in docker (https://support.cloudbees.com/hc/en-us/articles/360001566111-Set-up-a-Docker-in-Docker-Agent-Template) if possible (https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/), but I'll adapt to whatever works.

Is there a correct way to build using containers for jenkins, and the slaves?

Thank you.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9fb2d785-1b74-c0d4-dd05-4b072e8efe59%40posteo.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to