[SOLVED] Strange error with images built in Docker Toolbox: "exec: start.sh: not found"

I’m trying to run this project/image with Docker Toolbox

# docker-machine -v

docker-machine.exe version 0.14.0, build 89b8332

# docker-compose -v

docker-compose version 1.20.1, build 5d8c71b2

# docker -v

Docker version 18.03.0-ce, build 0520e24302

# docker info

Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.03.0-ce
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.89-boot2docker
Operating System: Boot2Docker 18.03.0-ce (TCL 8.2.1); HEAD : 404ee40 - Thu Mar 22 17:12:23 UTC 2018
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.6MiB
Name: default
ID: ORDL:XAVD:NUVO:2E3M:X5QS:HI4G:GE5J:WFB7:SREP:GQZO:YR7Y:VDTL
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Labels:
provider=virtualbox
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

# VBoxManage -v

5.2.8r121009

# docker-compose up

Everything works as expected

# docker-compose down

But, when I try to build the image and run (instead of using the official image):

# docker build -t novosga:2.0.0-RC3 .

Change docker-compose.yml to use novosga:2.0.0-RC3

# docker-compose up

novosga_1 | /usr/local/bin/docker-php-entrypoint: 9: exec: start.sh: not found

More info:

# docker run -it --rm novosga/novosga sh -c 'ls -la /usr/local/bin'

total 24068
drwxrwsr-x 2 root staff 4096 Mar 27 14:24 .
drwxrwsr-x 25 root staff 4096 Mar 27 14:24 …
-rwxrwxr-x 1 root root 1346 Mar 14 15:16 apache2-foreground
-rwxrwxr-x 1 root root 133 Mar 14 15:16 docker-php-entrypoint
-rwxrwxr-x 1 root root 1418 Mar 14 15:16 docker-php-ext-configure
-rwxrwxr-x 1 root root 2460 Mar 14 15:16 docker-php-ext-enable
-rwxrwxr-x 1 root root 2379 Mar 14 15:16 docker-php-ext-install
-rwxrwxr-x 1 root root 587 Mar 14 15:16 docker-php-source
-rwxr-xr-x 1 root staff 817 Mar 14 15:19 pear
-rwxr-xr-x 1 root staff 838 Mar 14 15:19 peardev
-rwxr-xr-x 1 root staff 754 Mar 14 15:19 pecl
lrwxrwxrwx 1 root staff 9 Mar 14 15:19 phar → phar.phar
-rwxr-xr-x 1 root staff 14829 Mar 14 15:19 phar.phar
-rwxr-xr-x 1 root staff 12216864 Mar 14 15:19 php
-rwxr-xr-x 1 root staff 2619 Mar 14 15:19 php-config
-rwxr-xr-x 1 root staff 12347496 Mar 14 15:19 phpdbg
-rwxr-xr-x 1 root staff 4547 Mar 14 15:19 phpize
-rwxr-xr-x 1 root root 875 Mar 27 14:15 start.sh

# docker run -it --rm novosga:2.0.0-RC3 sh -c 'ls -la /usr/local/bin'

total 24068
drwxrwsr-x 2 root staff 4096 Mar 30 18:48 .
drwxrwsr-x 25 root staff 4096 Mar 30 18:48 …
-rwxrwxr-x 1 root root 1346 Mar 14 15:16 apache2-foreground
-rwxrwxr-x 1 root root 133 Mar 14 15:16 docker-php-entrypoint
-rwxrwxr-x 1 root root 1418 Mar 14 15:16 docker-php-ext-configure
-rwxrwxr-x 1 root root 2460 Mar 14 15:16 docker-php-ext-enable
-rwxrwxr-x 1 root root 2379 Mar 14 15:16 docker-php-ext-install
-rwxrwxr-x 1 root root 587 Mar 14 15:16 docker-php-source
-rwxr-xr-x 1 root staff 817 Mar 14 15:19 pear
-rwxr-xr-x 1 root staff 838 Mar 14 15:19 peardev
-rwxr-xr-x 1 root staff 754 Mar 14 15:19 pecl
lrwxrwxrwx 1 root staff 9 Mar 14 15:19 phar → phar.phar
-rwxr-xr-x 1 root staff 14829 Mar 14 15:19 phar.phar
-rwxr-xr-x 1 root staff 12216864 Mar 14 15:19 php
-rwxr-xr-x 1 root staff 2619 Mar 14 15:19 php-config
-rwxr-xr-x 1 root staff 12347496 Mar 14 15:19 phpdbg
-rwxr-xr-x 1 root staff 4547 Mar 14 15:19 phpize
-rwxr-xr-x 1 root root 904 Mar 28 14:11 start.sh

The file start.sh is there with same contents, but with diferente sizes.

Can someone reproduce this?

What’s your host OS? How did you get the source?

https://github.com/novosga/docker/blob/master/novosga-2.0/start.sh says it’s 875 bytes, which matches what’s in the official image. But if you have a Windows host, and your copy of the source has DOS CR+LF line endings, that file has 29 newlines, and if there are 29 extra carriage return bytes, that adds up to 904 bytes, which matches your image. When the image actually runs, it’s on a Linux VM, which expects only Unix LF line endings, so it’s trying to run /bin/sh^M as an interpreter and not finding it, hence the “command not found” error.

Just a guess, but…

Hello, thank you for your quick reply!
I’m running Docker Toolbox for Windows 10, I did

# git clone https://github.com/novosga/docker.git

I’ve openned this project with Visual Studio Code and created the docker-compose.yml, I didn’t modify others files.
I’m using Git for Windows.

EDIT: I’ve changed line endings to LF (Unix Style) and it’s ok now. Thank you!