Search code examples
dockeralpine-linuxexeclines6

Run execlineb when container start failed. Docker for windosw


I'm trying to run simple script inside docker container after start. Initialy previous developer decided to use s6 inside.

#!/usr/bin/execlineb -P

foreground { sleep 2 }
nginx

When i'm trying to start i'm gettings this message

 execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W ] [ -c commandline ] script args

Looks like something wrong with executing this scripts or with execline.

I'm using docker for windows under windows10, however if somebody else trying to build this container in ubuntu(or any othe linux) evething is ok.

Can anybody help with this kind of problem?

DockerImage: simple alpine


Solution

  • According to our research of this "HUGE" problem we found two ways to solve it. Definitely it's a problem with special symbols, like '\r'

    Option 1 dostounix:

    1. install dostounix in your container(in docker file)

      RUN apk --no-cache add \ dos2unix \

    2. run it againts your sh script.

      RUN for file in {PathToYourFiles}; do \ dos2unix $file; \ chmod a+xwr $file; \ done

    3. enjoy your scripts.

    Option 2 VsCode(or any textEditor):

    1. Change CRLF 'End Of Line Sequence' to LF VS Code bottom panel Line endings options
    2. enjoy your scripts.