Jenkins does not seem to be running inside a container 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"
              }
            }
        }
    }
}






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

After doing R&amp;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 .
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.