0

I discovered a really strange behaviour of my Dockerfile. It works perfectly under my linux machine but under windows I got a weird output running my container. Could somebody check my commands and tell me what is wrong with them? Why it works under ubuntu without any problems? I thought docker ensures that it can be started in the same way under different operations systems...

Windows commands:

git clone https://github.com/falent/googleHomeAssistantExpressNodeJS.git C:\Users\%username%\Documents\googleHomeAssistantExpressNodeJS

$ cd C:\Users\%username%\Documents\googleHomeAssistantExpressNodeJS

$ sudo build -t assistant .

$ docker run -v /C/Users/%username%/Documents/googleHomeAssistantExpressNodeJS:/skill -it --name myAssistant assistant

I got this output under windows:

: not foundypoint.sh: 2: /skill/entrypoint.sh:
sleep: invalid time interval '10s\r'
Try 'sleep --help' for more information.
/skill/entrypoint.sh: 4: cd: can't cd to /skill

Dockerfile:

FROM node:slim

RUN npm install -g nodemon@1.14.7

COPY package.json /skill/package.json

RUN mkdir -p /skill/
WORKDIR /skill/
RUN npm install

COPY entrypoint.sh /skill
RUN chmod +x /skill/entrypoint.sh

ENTRYPOINT ["sh","/skill/entrypoint.sh"]

entrypoint.sh

#!/bin/sh

sleep 10s
cd /skill
npm install
nodemon 
ErikMD
  • 13,377
  • 3
  • 35
  • 71
Anna K
  • 1,666
  • 4
  • 23
  • 47
  • Do you have docker configured to use Linux-based containers on windows? – jonrsharpe Nov 10 '18 at 16:05
  • Just by reading your truncated error message `: not foundypoint.sh: 2: /skill/entrypoint.sh: sleep: invalid time interval '10s\r'` it is almost sure that you have an encoding issue with your script (with Windows newlines "\r\n" instead of Linux newlines "\n") – ErikMD Nov 10 '18 at 16:08
  • @ErikMD how can I fix it? that it works under windows and linux? – Anna K Nov 10 '18 at 16:12
  • You could try to follow the suggestions from [this SO answer](https://stackoverflow.com/a/31885410/9164010), and also make sure that your Git configuration on Windows doesn't silently turn all regular Linux newlines into Windows newlines... – ErikMD Nov 10 '18 at 16:13

0 Answers0