I have perform the below steps:
Install plugins for ssh, ssh credentials, ssh build agent, git, pipeline and docker and restart after install.
ssh into ststor01 with natasha, and replace index.html with Welcome to xFusionCorp Industries!
git add, commit, and push to dev branch, and check in gitea with sarah credentials.
add sarah, banner and natasha credentials in jenkins credentials.
configure system to add remote host of stapp03.
create new pipeline with script:
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'sshpass -p BigGr33n ssh -o StrictHostKeyChecking=no banner@stapp03'
sh 'git clone http://git.stratos.xfusioncorp.com/sarah/mr_job.git'
sh 'cd mr_job'
sh 'docker build -t stregi01.stratos.xfusioncorp.com:5000/nginx:latest .'
sh 'docker push stregi01.stratos.xfusioncorp.com:5000/nginx:latest'
}
}
stage('Deploy') {
steps {
sh 'sshpass -p BigGr33n ssh -o StrictHostKeyChecking=no banner@stapp03'
sh 'docker stop nginx-app'
sh 'docker rm nginx-app'
sh 'docker run -d --name nginx-app -p 8080:80 stregi01.stratos.xfusioncorp.com:5000/nginx:latest'
}
}
}
}
And got the error message below:
Started by user admin
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/nginx-container
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh
+ sshpass -p BigGr33n@ ssh -o StrictHostKeyChecking=no banner@stapp03
Pseudo-terminal will not be allocated because stdin is not a terminal.
+ rm -rf mr_job
+ git clone http://git.stratos.xfusioncorp.com/sarah/mr_job.git
Cloning into 'mr_job'...
+ cd mr_job
+ docker build -t stregi01.stratos.xfusioncorp.com:5000/nginx:latest .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
Stage "Deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
I have check that in stapp03, docker daemon is running.
Please advise where did i did wrong or missing any steps. Thanks