Jenkins build how to get docker images

  docker, jenkins, kubernetes

I have EKS cluster setup with single managed node group its contains two (worker ec2 VM). I deployed Jenkins inside the k8s cluster its is up and running without any issue.

Note: in Jenkins – configure system – cloud – k8 specification – Kubernetes URL – I placed my master address where my EKS cluster is running Kubernetes control plane is running at and also connection test is successful.

k8s cloud configuration

Next when I’m running Jenkins build creating Jenkins build pod and once the build is completed Jenkins build pod also getting terminated automatically.

Note: In Jenkins I have only single node master and there is no salve. when jenkins file create Docker image using below code and also image successfully tagged with based my code.

Now the question is after building Docker image where should i get the Docker images to deploy into my k8s environment. Note: I’m not using any Docker registry container to upload my docker images in this case how do i get my Docker images.

 stage('Build Docker Image') {
      container('docker') {
        echo 'docker'
        sh "docker build --network=host -t myimage:mytag ."
        sh 'pwd'
        sh 'ls -lrt'
        sh 'docker images | grep devops'
        sh 'hostname'

Jenkins logs output

[Pipeline] sh
+ docker images
+ grep devops
myimage/mytag                  build-12345      8b1c58dcc39d   3 seconds ago       583MB

[Pipeline] sh
+ hostname

Source: Docker Questions