Mounting a directory to a container gets set with wrong path

I am trying to mount a directory of my host machine to a container.
The command I use for the same:

docker run --name test -v "$(pwd)":/app <image-name>

The pwd is like = /d/Docker/ProjectsWithDocker/react-frontend

But when I inspect I get (docker inspect test):

"Mounts": [
            {
                "Type": "bind",
                "Source": "D:\\Docker\\ProjectsWithDocker\\react-frontend;C",
                "Destination": "\\Program Files\\Git\\app",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }

Note the ā€œSourceā€ got appended with a ;C and because of this correct directory isnā€™t mounted.
How do I fix this ?

1 Like

Did you ever resolve this? I am having the same issue, and cannot find anything to help.

Edit: Switched over to ubuntu and my mount worked fine, seems to be an issue with Git Bash.

2 Likes

I also have the same issue from git bash.

There were similar reports where it also turned out it was caused by Git Bash which was not compatible with the docker commands. Try powershell or a WSL2 distribution when WSL2 intergation is enabled and when you are using the WSL2 backend.

1 Like

Thanks it worked for me.