Day 27:Jenkins Declarative Pipeline with Docker

Hello, I am Akshay Phadke I have 10 Yrs of Experience in various Technologies. Currently, I am learning a few DevOps tools. I am working on Microsoft Technologies and AWS
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.
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
1)Create a docker-integrated Jenkins declarative pipeline
In Jenkins, Click on “New Item”, create a new pipeline job, and select "Pipeline" as the project type.

2)Use the above-given syntax using sh inside the stage block
In the configuration, In the pipeline script section, define your stages, steps, and parameters.


Save and run the pipeline. You should see the pipeline execute each stage and run your application inside a Docker container.

Console Output:

Task-02:
1)Create a docker-integrated Jenkins declarative pipeline using the docker groovy syntax inside the stage block.








