Reputation: 173
pipeline { agent any options { timeout(time: 5, unit: 'MINUTES') disableConcurrentBuilds() } stages { stage('Checkout') { steps { script { checkout([ $class: 'GitSCM', branches: [[name: "origin/master"]], userRemoteConfigs: [[url: 'https://github.com/mmmmmmmmm.git']] ]) } } }
stage('Cleanup') {
steps {
echo 'Starting the Pipeline'
sh 'docker rm -f $(docker ps --all --quiet) || true'
sh 'docker rmi -f $(docker images --quiet) || true'
}
}
stage('build') {
steps {
sh 'docker build -t test --no-cache .'
}
}
stage('Run') {
steps {
sh 'docker run -d --name test -p 80:80 test '
}
}
stage('Login') {
steps {
sh 'docker container exec -it test /bin/bash '
sh 'ls -ltr'
}}}}
Error: docker container exec -it test /bin/bash the input device is not a TTY
And how to run curl command for the jenkins server port 80?
Thank you
Upvotes: 0
Views: 116
Reputation: 2076
You can directly pass the curl
command with exec
like below.
sh "docker exec containerName /bin/bash -c 'curl http://jenkins-server:80'"
Upvotes: 0