1

I am getting an error while running the Jenkins file tp build and push the docker image into docker hub .

you can reveiw my code github : https://github.com/iakshaykr/webapp.git (using jenkins_pipe branch not master branch )

Jenkinsfile :

pipeline {
    environment {
        registry= "iakshaykr/webapp"
        registryCredential= 'dockerhub'
    }

    agent { dockerfile true }

    stages {
        stage('Bilding image') {
            steps {
             script {
                 docker.build registry + ":$BUILD_NUMBER"
              }
            }
        }
    }
}

Screenshot of the jenkins job log


Below solution valid on Error code 127.If you are getting any other error code let me know .

After doing R&D finally got the solution.

1st test your code in Jenkins using shell command which is in build option :

cmd : docker build . -t newimage

2nd test : use the docker plugin (Plugin name :CloudBees Docker Build and Publish)

3rd test : use the build option : pipeline scm

code : https://github.com/iakshaykr/webapp.git Use : jenkins_pipe branch

Please test the thing ,in case any error please reply back .

Note : First setup/add the credentials for dockerhub in your jenkins for authentication .

1

If you simply google "jenkins does not seem to be running inside a container", you will see that it's only an informational message. Surely, it could be worded better, but it's pretty much harmless.

| improve this answer | |
  • Hey i tried that's why i put here in Devops community ,from my end i had done all R&D to fix this error . Hope you better suggestion . Thanksg – Akshay Kumar Nov 11 '19 at 8:21
  • 1
    As stated in my answer, it's not an error. – schaiba Nov 11 '19 at 8:22
  • Yes but i tried to deploy and push the app into dockerhub but its failing but if i tried same from my local machine without CI/CD its working perfectly,so it means my process and code with Dockerfile is correct ,issue somewhere in that Jenkins file which i have written or might be jenkins plugin nor sure . – Akshay Kumar Nov 11 '19 at 8:24
  • ERROR : script returned exit code 127 Finished : FAILURE this error i am getting while running the pipeline from jenkins . – Akshay Kumar Nov 11 '19 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.