exec: "cat": executable file not found in $PATH: unknown.'

145 Views Asked by At

Failed to run image docker.io/hadolint/hadolint:v2.8.0 . Error: docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: run c create failed: unable to start container process: exec: "cat": executable file not found in $PATH: unknown.

but when I change "docker.io/hadolint/hadolint:v2.8.0" with version "docker.io/hadolint/hadolint:v1.18.0

, there is no errors

Here is my Jenkins pipeline,

        stage("Lint") {
            agent {
                docker {
                    image "docker.io/hadolint/hadolint:v2.8.0"
                   
                    reuseNode true
                }
            }
            steps {
                script {
                    def result = sh label: "Lint Dockerfile",
                        script: """\
                            hadolint Dockerfile > hadolint-results.txt
                        """,
                    returnStatus: true
                    if (result > 0) {
                        unstable(message: "Linting issues found")
                    }
                }
            }
        }
1

There are 1 best solutions below

1
micke On

The docker plugin in Jenkins tries to start cat in the container to keep it running while your script(s) are executed. The :v2.8.0 image doesn't have cat in it (it's a scratch image) so it can't be run in Jenkins the same way.

The proper solution depends on your version of Jenkins and the docker plugin.

See https://issues.jenkins.io/browse/JENKINS-39748