Run a script in Dockerfile

后端 未结 5 1076
无人及你
无人及你 2020-12-22 22:34

I\'m trying to run a script during my building process in my Dockerfile. But it doesn\'t seems to work.

I tried that way:

FROM php:7-fpm
ADD bootstra         


        
5条回答
  •  抹茶落季
    2020-12-22 22:59

    In addition to the answers above:

    If you created/edited your .sh script file in Windows, make sure it was saved with line ending in Unix format. By default many editors in Windows will convert Unix line endings to Windows format and Linux will not recognize shebang (#!/bin/sh) at the beginning of the file. So Linux will produce the error message like if there is no shebang.

    Tips:

    • If you use Notepad++, you need to click "Edit/EOL Conversion/UNIX (LF)"
    • If you use Visual Studio, I would suggest installing "End Of Line" plugin. Then you can make line endings visible by pressing Ctrl-R, Ctrl-W. And to set Linux style endings you can press Ctrl-R, Ctrl-L. For Windows style, press Ctrl-R, Ctrl-C.

提交回复
热议问题