Jenkins MR Job Level 4 Task 3 - Getting docker error

In Jenkins Level 4 Task 3, I have written the correct pipeline, but still getting the below error. Can someone please help?

Pipeline code

pipeline {
    agent {
        label 'stapp03'
    }

    stages {
        stage('Build') {
            steps {
                script{
                    git credentialsId: 'sarah', url: 'http://git.stratos.xfusioncorp.com/sarah/mr_job.git'

                    sh 'docker build -t stregi01.stratos.xfusioncorp.com:5000/nginx:latest .'
                    sh 'docker push stregi01.stratos.xfusioncorp.com:5000/nginx:latest'
                }
            }
        }

        stage('Deploy') {
            steps {
                script {
                    sh 'docker run -d --name nginx-app -p 8080:80 stregi01.stratos.xfusioncorp.com:5000/nginx:latest'
                }
            }
        }
    }
}

Error

Started by user admin

[Pipeline] Start of Pipeline
[Pipeline] node
Running on App Server 3
 in /home/banner/workspace/nginx-container
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] script
[Pipeline] {
[Pipeline] git
The recommended git tool is: NONE
using credential sarah
Cloning the remote Git repository
Avoid second fetch
Checking out Revision cf312bedd489ed6061a59b997696c5f9cc0326f1 (refs/remotes/origin/master)
Cloning repository http://git.stratos.xfusioncorp.com/sarah/mr_job.git
 > git init /home/banner/workspace/nginx-container # timeout=10
Fetching upstream changes from http://git.stratos.xfusioncorp.com/sarah/mr_job.git
 > git --version # timeout=10
 > git --version # 'git version 2.47.3'
using GIT_ASKPASS to set credentials 
 > git fetch --tags --force --progress -- http://git.stratos.xfusioncorp.com/sarah/mr_job.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url http://git.stratos.xfusioncorp.com/sarah/mr_job.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git config core.sparsecheckout # timeout=10
 > git checkout -f cf312bedd489ed6061a59b997696c5f9cc0326f1 # timeout=10
 > git branch -a -v --no-abbrev # timeout=10
 > git checkout -b master cf312bedd489ed6061a59b997696c5f9cc0326f1 # timeout=10
Commit message: "Merge pull request 'My First PR' (#1) from dev into master"
First time build. Skipping changelog.
[Pipeline] sh
+ docker build -t stregi01.stratos.xfusioncorp.com:5000/nginx:latest .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 109B done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/nginx:stable-alpine3.17-slim
#2 DONE 0.2s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 72B done
#4 DONE 0.0s

#5 [1/2] FROM docker.io/library/nginx:stable-alpine3.17-slim@sha256:5893dc08a2cb01e21592ff469346ebaacf49167fbc949f45e1c29111981b0427
#5 resolve docker.io/library/nginx:stable-alpine3.17-slim@sha256:5893dc08a2cb01e21592ff469346ebaacf49167fbc949f45e1c29111981b0427 0.0s done
#5 extracting sha256:3c854c8cbf469fda815b8f6183300c07cfa2fbb5703859ca79aff93ae934961b
#5 sha256:3c854c8cbf469fda815b8f6183300c07cfa2fbb5703859ca79aff93ae934961b 3.38MB / 3.38MB 0.0s done
#5 sha256:da33b1ad0ac4b49641e40469216939f6488c1d8116b2513ba2caa561d4898067 954B / 954B 0.0s done
#5 sha256:ee5112eafd255a2c921521a50e807fefd946c83b6d623260ff1d01e856423454 7.15kB / 7.15kB done
#5 sha256:de5d475193dd13b444c2e58fc772d8a3297e370eb90e67e483095bb25f1861a6 1.80MB / 1.80MB 0.0s done
#5 sha256:b407bcc8063852cf7b980fa6d83d6caa2c17b2fa4c10e87835d72f21ed40c41a 625B / 625B 0.0s done
#5 sha256:a0fbd691d7c1a07fbdeb8b338578f4e199a49e2491eff171105eb0dc7cf61628 768B / 768B 0.1s done
#5 sha256:16eaaaf5f1c0db05389b2c1c2d90db8c9154289520fad38d580acdf2390e846e 1.40kB / 1.40kB 0.1s done
#5 sha256:5893dc08a2cb01e21592ff469346ebaacf49167fbc949f45e1c29111981b0427 9.04kB / 9.04kB done
#5 sha256:d0f2d6365b23b7015088c88ee42f119cf585d05558a72d55625e54454c78d3e6 2.11kB / 2.11kB done
#5 extracting sha256:3c854c8cbf469fda815b8f6183300c07cfa2fbb5703859ca79aff93ae934961b 0.2s done
#5 extracting sha256:de5d475193dd13b444c2e58fc772d8a3297e370eb90e67e483095bb25f1861a6 0.1s
#5 extracting sha256:de5d475193dd13b444c2e58fc772d8a3297e370eb90e67e483095bb25f1861a6 0.3s done
#5 extracting sha256:b407bcc8063852cf7b980fa6d83d6caa2c17b2fa4c10e87835d72f21ed40c41a 0.1s done
#5 extracting sha256:da33b1ad0ac4b49641e40469216939f6488c1d8116b2513ba2caa561d4898067 0.1s done
#5 extracting sha256:a0fbd691d7c1a07fbdeb8b338578f4e199a49e2491eff171105eb0dc7cf61628
#5 extracting sha256:a0fbd691d7c1a07fbdeb8b338578f4e199a49e2491eff171105eb0dc7cf61628 0.1s done
#5 extracting sha256:16eaaaf5f1c0db05389b2c1c2d90db8c9154289520fad38d580acdf2390e846e 0.1s done
#5 DONE 0.9s

#6 [2/2] COPY index.html /usr/share/nginx/html/
#6 DONE 0.1s

#7 exporting to image
#7 exporting layers
#7 exporting layers 0.9s done
#7 writing image sha256:af761b8ffff16c0fea9e410f3bb9f274289877fd0aa35a31328a5f19744d194b done
#7 naming to stregi01.stratos.xfusioncorp.com:5000/nginx:latest done
#7 DONE 0.9s
[Pipeline] sh
+ docker push stregi01.stratos.xfusioncorp.com:5000/nginx:latest
The push refers to repository [stregi01.stratos.xfusioncorp.com:5000/nginx]
35bbb4cb0d23: Preparing
66afb7c3e6d1: Preparing
439be94dd989: Preparing
08761a690f84: Preparing
419b89bbfa3b: Preparing
5fa2288e0d6e: Preparing
f4111324080c: Preparing
5fa2288e0d6e: Waiting
f4111324080c: Waiting
35bbb4cb0d23: Pushed
66afb7c3e6d1: Pushed
439be94dd989: Pushed
08761a690f84: Pushed
419b89bbfa3b: Pushed
5fa2288e0d6e: Pushed
f4111324080c: Pushed
latest: digest: sha256:89dc2b621a3f317b24b3276778e5896088e3e82a2dff33ef220d822ffbb23790 size: 1775
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ docker run -d --name nginx-app -p 8080:80 stregi01.stratos.xfusioncorp.com:5000/nginx:latest
73a696e37d902e732da0a683b64145f2249f5fc00fabd8b13394aba681c6f068
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/8, flags=0xe: no such file or directory: unknown

Run 'docker run --help' for more information
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE

Hi @yash1307

Thanks for your feedback. I’m trying to reproduce the issue and will keep you updated.

Hi @yash1307

After checking, the issue appears to be related to docker run in the app services, even when using the hello-world container. I’m investigating the root cause and will update the team if it’s related to the lab.

Hi @raymond.baoly ,
Thanks for the update, and yes, you are correct, the issue is related to docker run. I have seen similar errors in Docker tasks also. Please let me know if you can find the solution or what the KodeKloud team said once you forward this to them.

Hi @yash1307

FYI, the issue only appears after installing Java 17 in the app services for the Jenkins agent. It seems there is a package conflict preventing Docker from running containers.

Hi @yash1307

Please try again using this command to install Java 17 for the Jenkins agent. After this, we should still be able to run Docker containers. The root cause is that installing Java via yum can pull in updates to glibc, kernel headers, or other dependencies, which can sometimes cause Docker/runc to fail temporarily.

sudo yum install --setopt=obsoletes=0 --nogpgcheck --nobest java-17-openjdk-devel -y

Hi @yash1307

I was able to pass the task using the Java installation command above. Please try again.

Hi @raymond.baoly ,
Thank you for this solution. I will try this and I will let you know.

Hi @raymond.baoly ,
I am confirming that the solution provided by you has worked properly, and the Jenkins pipeline executed successfully on the respective node. As a result, the task is completed successfully.

Thank you so much for your help :smiling_face:

Is this issue resolved?

Hi @Divya1

This issue isn’t related to the task itself. We need to install the Java version properly to avoid conflicts with Docker on the Jenkins agent node.