Jenkins Declarative Pipeline with Docker

Jenkins Declarative Pipeline with Docker

Docker Build:-

Docker Build is one of Docker Engine's most used features. Whenever you are creating an image you are using Docker Build. Build is a key part of your software development life cycle allowing you to package and bundle your code and ship it anywhere.

Docker Build is more than a command for building images, and it's not only about packaging your code. It's a whole ecosystem of tools and features that support not only common workflow tasks but also provides support for more complex and advanced scenarios.

Docker Run:-

docker run is a command in Docker, a popular platform for developing, shipping, and running applications in containers. Containers allow you to package an application and its dependencies into a single unit, ensuring consistency and portability across different environments.

The docker run command is used to create and start a new container based on a specified Docker image.

How will the stages look:-

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

Today's Task:-

  • Create a docker-integrated Jenkins declarative pipeline

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

  • You will face errors in case of running a job twice, as the docker container will be already created.

Day 27 of #90daysofDevOps

Thanks for reading

Follow me for more about DevOps♾️........

________________________________________________________________________________

#90daysHardChallenge

#Cloudcomputing

#DevOps

#Python

#TrainWithShubham