docker build command add 'C:/Program Files/Git' to the path passed as build argument when executed in MINGW bash on Windows

前端 未结 2 1208
说谎
说谎 2021-02-19 17:43

I have following Dockerfile:

FROM ubuntu:16.04

ARG path1=def_path1
RUN mkdir ${path1}

When I build this Dockerfile using following command:

2条回答
  •  独厮守ぢ
    2021-02-19 18:17

    This is actually a bug/limitation of Git for Windows as described in the Release Notes under Known issues:

    If you specify command-line options starting with a slash, POSIX-to-Windows path conversion will kick in converting e.g. "/usr/bin/bash.exe" to "C:\Program Files\Git\usr\bin\bash.exe". When that is not desired -- e.g. "--upload-pack=/opt/git/bin/git-upload-pack" or "-L/regex/" -- you need to set the environment variable MSYS_NO_PATHCONV temporarily, like so:

    MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc
    

    Alternatively, you can double the first slash to avoid POSIX-to-Windows path conversion, e.g. "//usr/bin/bash.exe".

提交回复
热议问题