Use a docker image with jenkins declarative pipeline

0 votes
I have a docker image which I need to use with the Jenkins declarative pipeline. How do I do this?
Apr 12, 2019 in Jenkins by Jithin
2,319 views

1 answer to this question.

0 votes

Hey @Jithin, you could use something like this. Change the pipeline according to your specifications.

Jenkinsfile (Declarative Pipeline)

pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}
answered Apr 12, 2019 by Bishu

Related Questions In Jenkins

0 votes
1 answer

Can I use multiple containers on a jenkins declarative pipeline?

Yes of course you can!! You try ...READ MORE

answered Apr 12, 2019 in Jenkins by Vedant
1,557 views
0 votes
2 answers
0 votes
5 answers
0 votes
1 answer

Jenkins and Docker: How can I customize my jenkins pipeline to use docker?

Jenkins Pipeline is designed to easily use ...READ MORE

answered Aug 26, 2019 in Jenkins by Sirajul
• 52,710 points
419 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,530 points
526 views
0 votes
1 answer

Use Custom Docker registry with jenkins declarative pipeline

Yes, you can! try something like this: node ...READ MORE

answered Apr 12, 2019 in Jenkins by Bishu
690 views