Mount current directory as a volume in Docker on Windows 10

后端 未结 10 1026
滥情空心
滥情空心 2020-11-28 01:22

Description

I am using Docker version 1.12.5 on Windows 10 via Hyper-V and want to use container executables as commands in the current path. I buil

10条回答
  •  野性不改
    2020-11-28 01:25

    Other solutions for Git Bash provided by others didn't work for me. Apparently there is currently a bug/limitation in Git for Windows. See this and this.

    I finally managed to get it working after finding this GitHub thread (which provides some additional solutions if you're interested, which might work for you, but didn't for me).

    I ended up using the following syntax:

    MSYS_NO_PATHCONV=1 docker run --rm -it -v $(pwd):/usr/src/project gcc:4.9
    

    Note the MSYS_NO_PATHCONV=1 in front of the docker command and $(pwd) - round brackets, lower-case pwd, no quotes, no backslashes.

    Also, I'm using Linux containers on Windows if that matters..

    I tested this in the new Windows Terminal, ConEmu and GitBash, and all of them worked for me.

提交回复
热议问题