Weird error under Git bash (MSYS) (solved)

Expected behavior

Same behavior as under cmd shell:
C:\Users…>docker run ubuntu /bin/echo hello world
hello world

Actual behavior

Error under Git bash (MSYS):

$ docker run ubuntu /bin/echo hello world
c:\CloudStation\Programs\dev\Docker\docker.exe: Error response from daemon: Container command ‘C:/Program Files (x86)/Git/bin/echo’ not found or does not exist…

Information

Git bash is the central piece of my development environment, I used a ton of bash aliases & functions to be more productive. Without a solution to this, I’m stuck with either PowerShell or the standard Windows shell, which doesn’t fit in my workflow at all.

In my bash shell, I’m using that version of Docker: https://get.docker.com/builds/Windows/x86_64/docker-1.11.0.zip
I use the following aliases to execute it:

Folder where I have docker.exe & other utils (docker-compose.exe, etc)

export DOCKER_HOME=$DEV_SOFT_HOME/Docker

Add that folder to the path

append_to_path $DOCKER_HOME

Aliases for those

alias docker=$DOCKER_HOME/docker.exe
alias docker-machine='docker-machine.exe’
alias dockermachine='docker-machine’
alias dm='docker-machine’
alias docker-compose='docker-compose.exe’
alias dc=‘docker-compose’

Steps to reproduce the behavior

Execute the following command under Git bash (MSYS): docker run ubuntu /bin/echo lol

Actually I’ve just realized that this was a known issue on Docker’s github!

I could fix it by:

  • installing the latest Git version for Windows
  • changing my docker alias (see below)

docker()
{
export MSYS_NO_PATHCONV=1
("$DOCKER_HOME/docker.exe" “$@”)
export MSYS_NO_PATHCONV=0
}

With the above I get the expected behavior. YAY!

1 Like

Awesome, thanks for following up. If you don’t mind, please post the link to the issue for tracking.

Michael