Mount current directory as a volume in Docker on Windows 10

后端 未结 10 1040
滥情空心
滥情空心 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:39

    For Git Bash for Windows (in ConEmu), the following works for me (for Docker Windows containers):

    docker run --rm -it -v `pwd -W`:c:/api microsoft/dotnet:2-runtime
    

    Note the backticks/backquotes around pwd -W!

    With all other variations of PWD I've tried I've received: "Error response from daemon: invalid volume specification: ..."

    Update: The above was for Docker Windows containers, for Linux containers use:

    docker run --rm -it -v `pwd -W`:/api -p 8080:80 microsoft/aspnetcore:2
    

提交回复
热议问题