🔄Day 27 - Jenkins Declarative Pipeline with Docker

🔄Day 27 - Jenkins Declarative Pipeline with Docker

💎Use your Docker Build and Run Knowledge

docker build - you can use sh 'docker build . -t <tag>' in your pipeline stage block to run the docker build command. (Make sure you have docker installed with correct permissions.

docker run: you can use sh 'docker run -d <image>' in your pipeline stage block to build the container.

How will the stages look

stages {
        stage('Build') {
            steps {
                sh 'docker build -t trainwithshubham/django-app:latest'
            }
        }
    }

💎Task-01

  • Create a docker-integrated Jenkins declarative pipeline

  • Use the above-given syntax using sh inside the stage block

  1. Create a new job, select pipeline project.

  1. Under Source Code Management, select Git and Added the repository URL.

  1. Within the Jenkins job's Pipeline build step, Write declarative pipeline script.

  1. Save and click on Build Now.

  1. You can check your logs in Console Output.

📚Happy Learning :)