# Day 25 Task: Jenkins Declarative Pipeline with Docker

***<mark>Docker build</mark> :-*** we 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.

**<mark>Docker run</mark> :-** we can use `sh 'docker run -d <image>'` in your pipeline stage block to build the container

# Task-01;-

* Create a docker-integrated Jenkins declarative pipeline:
    
    **Step: 1**
    
    In Jenkins, Click on **New Item**, create a new pipeline job, and select **Pipeline** as the project type.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701798828056/fe43c6c2-9dbb-4476-bd0b-6d8d056e6a5c.png align="center")
    

**Step: 2**

2.give the proper detail fill your GitHub project and git repo address.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701800830262/ce0799e3-d901-43b4-9807-6cd072969461.png align="center")

3\. create a pipeline for docker images and run the container.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701804086541/9f1793d0-8afa-4a2a-9af0-ecd01ff50dd0.png align="center")

4.Save your configuration & build the job

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701833248669/f92318fe-bf67-4d17-a6ed-442835d05fb3.png align="center")

# *<mark>Task-02</mark>*

1.Create a docker-integrated Jenkins declarative pipeline using the `docker` groovy syntax inside the stage block.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701833402147/f62b800e-3cda-48c9-885b-1b4493b76313.png align="center")

2\. You won't face errors, you can Follow.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701833479175/6d9e505f-738b-4676-819c-b4464962801f.png align="center")

3\. Complete projects using this Declarative pipeline in docker and docker-compose

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701833675224/d2f74fc7-aa88-43cd-9e97-3600c86ddb6a.png align="center")

1. we can web access
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701833797148/b8db67f0-dd1d-4a0d-a00a-197e3771a756.png align="center")
    

Thanks for read my blog if you like this blog please like and commend.

Contact me on [**linkedin**](http://www.linkedin.com/in/pradeep-chitroliya-9347a9147)

check out my GitHub for more resource [**GitHub**](https://github.com/ChitrolyaPradeep)
