Using RUN command in Dockerfile on Windows and Linux

Keywords´╝Ü linux windows bash docker docker-compose

Question: 

In my Dockerfile I have

FROM microsoft/dotnet:2.1-sdk
COPY devops/scripts/setup.sh .
RUN ls
RUN chmod +x ./setup.sh 
RUN ./setup.sh
WORKDIR /app

Step 3 I am using just to show that file is actually present.

When used in docker-compose this works perfectly on Linux, but when runnning docker-compose up on Windows it results in

> docker-compose up
Building create_template
Step 1/6 : FROM microsoft/dotnet:2.1-sdk
 ---> 511c1f563ce6
Step 2/6 : COPY devops/scripts/setup.sh .
 ---> 3d3bb4ab9bc4
Step 3/6 : RUN ls
 ---> Running in 43ad6e244ed8
bin
boot
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
setup.sh     <--- 
srv
sys
tmp
usr
var
Removing intermediate container 43ad6e244ed8
 ---> aa32210d6a87
Step 4/6 : RUN chmod +x ./setup.sh
 ---> Running in 2d6858495355
Removing intermediate container 2d6858495355
 ---> 5e0388623851
Step 5/6 : RUN ./setup.sh
 ---> Running in abb3a52fe6ec
/bin/sh: 1: ./setup.sh: not found
ERROR: Service 'create_template' failed to build: The command '/bin/sh -c ./setup.sh' returned a non-zero code: 127

Is there a way to use same dockerimage files and commands on both systems or do I have to have alternate dockerimage and docker-compose for each? Thank you

Answers: