Git Bash rewrites the Linux paths you pass to docker run
Your error
docker: Error response from daemon: the working directory 'C:/Program Files/Git/app' is invalid, it needs to be an absolute path2 more lines it can showFix it fast
Most common cause, 1 of 2Git Bash converts the container-side path into a Windows path
Switch the conversion off for that command, as Docker's guide shows, or write the container path with a leading double slash so MSYS leaves it alone; Linux treats the repeated slash as one.
# Git Bash: no conversion for this one command
MSYS_NO_PATHCONV=1 docker run --rm -ti -w /app -v "$(pwd)":/work alpine
# or keep conversion on and double the leading slash
docker run --rm -ti -w //app alpine pwd
# MSYS2 shells
MSYS2_ARG_CONV_EXCL='*' docker run --rm -w /app alpine pwdShort answer
In Git Bash on Windows, docker run -w /app or -v ...:/work fails with a path under C:/Program Files/Git because Git Bash (MSYS) converts arguments that look like Unix paths into Windows paths before docker runs. The Linux daemon then rejects them as not absolute. Prefix the command with MSYS_NO_PATHCONV=1 or write //app. Applies to Docker Desktop 4.x on Windows.
Which cause do you have?
Run one harmless container from the same Git Bash window, once as you normally would and once with conversion switched off. If only the first fails and its error contains Program Files\Git, Git Bash rewrote a container path (cause 1). If the host part of a -v flag appears with its backslashes missing, as in C:UsersUserwork, the shell ate them (cause 2).
docker run --rm -w /app alpine pwd
MSYS_NO_PATHCONV=1 docker run --rm -w /app alpine pwdThen find the line you see in this list and open its fix:
- 1Git Bash converts the container-side path into a Windows path
The error names C:/Program Files/Git/... or \Program Files\Git\..., a folder that only exists on the Windows side - 2Single backslashes in a Windows host path are eaten by the shell
The daemon reports a path like C:UsersUserwork, with every backslash gone, and Access is denied
What does the error look like?
docker: Error response from daemon: the working directory 'C:/Program Files/Git/app' is invalid, it needs to be an absolute pathmount destination \Program Files\Git\work not absolute: unknowndocker: Error response from daemon: mkdir C:UsersUserwork: Access is denied.
Cause 1 of 2
Git Bash converts the container-side path into a Windows path
You seeThe error names C:/Program Files/Git/... or \Program Files\Git\..., a folder that only exists on the Windows side
Check
Git Bash runs on MSYS, which converts every argument that looks like a Unix path when it calls a native Windows program such as docker.exe. /app becomes the Git installation folder plus app, and the destination after the colon in -v gets the same treatment. Docker's troubleshooting guide lists $(pwd), colon-separated paths and ~ among the arguments this preprocessing changes. The Linux daemon then checks the value: a working directory that does not start with / is rejected with the absolute-path error, and a bind mount destination fails as not absolute.
docker run --rm alpine echo /app # prints the rewritten argument, not /appFix
Switch the conversion off for that command, as Docker's guide shows, or write the container path with a leading double slash so MSYS leaves it alone; Linux treats the repeated slash as one. In a plain MSYS2 shell, MSYS2_ARG_CONV_EXCL='*' excludes every argument from conversion.
# Git Bash: no conversion for this one command
MSYS_NO_PATHCONV=1 docker run --rm -ti -w /app -v "$(pwd)":/work alpine
# or keep conversion on and double the leading slash
docker run --rm -ti -w //app alpine pwd
# MSYS2 shells
MSYS2_ARG_CONV_EXCL='*' docker run --rm -w /app alpine pwdVerify
The container prints /app as its working directory, and a mounted folder lists your files.
MSYS_NO_PATHCONV=1 docker run --rm -v "$(pwd)":/work alpine ls /workConfirmed by docs.docker.com
Cause 2 of 2
Single backslashes in a Windows host path are eaten by the shell
You seeThe daemon reports a path like C:UsersUserwork, with every backslash gone, and Access is denied
Check
In Git Bash a backslash has a special meaning, so C:\Users\user\work reaches docker with its backslashes stripped, as a path that does not exist. Docker's guide shows exactly this mkdir ... Access is denied failure for docker run -v C:\Users\user\work:/work typed in Git Bash. Docker Desktop also accepts the Unix-style form of a drive path, which avoids backslashes completely.
echo C:\Users\user\workFix
Write the host side as a Unix-style drive path (/c/Users/...), or double every backslash. When the command also uses a container path, keep MSYS_NO_PATHCONV=1 so that part is not rewritten.
MSYS_NO_PATHCONV=1 docker run --rm -ti -v /c/Users/user/work:/work alpine ls /work
# or keep the Windows form with doubled backslashes
MSYS_NO_PATHCONV=1 docker run --rm -ti -v C:\\Users\\user\\work:/work alpine ls /workVerify
ls /work inside the container shows the files from your Windows folder.
MSYS_NO_PATHCONV=1 docker run --rm -v /c/Users/user/work:/work alpine ls /workConfirmed by docs.docker.com
How do I stop it coming back?
- Put MSYS_NO_PATHCONV=1 at the top of shell scripts that call docker on Windows, or run them from PowerShell or a WSL 2 shell, where no MSYS conversion happens.
- Quote "$(pwd)" in -v flags so a folder name with spaces stays one argument.
- Keep Docker commands that the team shares in a Compose file, so container paths live in YAML instead of on a command line the shell can rewrite.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Dispatch Pro.