Docker Community Forums

Share and learn in the Docker community.

Error while running Docker code in Powershell

Hi,

I’m using this (Building a Docker Container) section. I could install the docker image and cd into “openface” folder. Now when I’m trying to run the command
./run-tests.sh

I’m getting the following error:

bash: ./run-tests.sh: /bin/bash^M: bad interpreter: No such file or directory

For this code:
./demos/compare.py images/examples/{lennon*,clapton*}

I’m getting the error:

: No such file or directory

But both the python code and the images exists in the respective folder.

Can anyone please tell me what can be the issue and how to resolve it?

Thank you!

The container itself based on Linux? If yes, till now Windows Server cant use Linux Container.

@funky81: Thanks for your reply! My server and container are both have linux. I downloaded docker and installed it in my windows 10 laptop. With this,as per my understanding, I’m getting linux container. Now I called the openface image file and installed it. Openface is a linux based image. Then I’m cd into openface folder and run these commands.

So I think I’m using both linux server as well as container. Please correct me if I’m wrong. I’m completely new in docker environment.

You can use Linux Container in Docker for Windows 10 by switching to Linux VM in the docker control panel (docker taskbar). But fortunately you cant do this with Windows Server.

@funky81: I’m using linux container only. Please find the screenshot attached. Please let me know if I’m missing something.

The issue is Git converted line endings to Windows format, and now you have extra carriage returns (^M).

  1. Configure Git not to convert line endings on checkout by running
    git config --global core.autocrlf input
  2. Delete your local repository.
  3. Clone it again.

For more info on how Git deals with line endings, see Formatting and Whitespace

2 Likes

@jdharmon: Thanks Jason! It worked.

I logged in only to say that this solution provided by jdharmon works like a charm in my case - Docker on Windows 10, project was originally built on Linux, default gitconfig

Try running a dockerfile more like

FROM mcr.microsoft.com/windows/servercore/iis

RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot*

WORKDIR /inetpub/wwwroot

COPY . /inetpub/wwwroot

maybe you gotta move your COPY command after the WORKDIR ? Try different things out

Thank you so much!!
I tried a lot of things but just this one worked!