Why won't my docker-entrypoint.sh execute?

前端 未结 11 1023
清歌不尽
清歌不尽 2021-01-31 08:02

My ENTRYPOINT script doesn\'t execute and throws standard_init_linux.go:175: exec user process caused \"no such file or directory\". Why so?

<
相关标签:
11条回答
  • 2021-01-31 08:27

    My case was that the alpine image I was using didn't come with bash at all... RUN apk-install bash did the trick obviously

    0 讨论(0)
  • 2021-01-31 08:30

    Another possibility:

    Check that the file is not saved with Windows line endings (CRLF). If it is, save it with Unix line endings (LF) and it will be found.

    0 讨论(0)
  • 2021-01-31 08:31

    Without seeing your image, my initial idea is that you don't have /bin/bash in your image. Changing the first line of your docker-entrypoint.sh to:

    #!/bin/sh
    

    will likely resolve it.

    0 讨论(0)
  • 2021-01-31 08:31

    Gosh I struggled for 2–3 hours!! Thanks to @Ryan Allen For my case it was CRLF problem. I am working on puppet manifests over ATOM for jenkins setup. Make sure if you are using ATOM or any other IDE on windows, when you take your file ( especially .sh) to unix, convert it to unix format. It worked like magic once converted. Here is what I added in my puppet file:

      exec {'dos2unix':
        path      => ['/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/puppetlabs/bin'],
        command   => 'dos2unix /dockerwork/puppet/jenkins/files/*',
        subscribe => File['/dockerwork/puppet/jenkins/files/init.sh'],
      }
    
    0 讨论(0)
  • 2021-01-31 08:33

    Another reason this error comes up is if your Windows User password changes.

    In my case my entrypoint.sh line endings were LF but I was still getting the error. Our admin has a mandatory password reset about every month or so. Whenever this happens I would run into the error. If this is your reason you may need to reset your credentials in docker settings under "Shared Drives".

    Unselect the drive and apply. Then reselect the drive and apply. It will prompt you for your password.

    0 讨论(0)
提交回复
热议问题