docker: Error response from daemon: invalid volume specification: "C:\data URIs/data URIsrw"
Fixes 'invalid volume specification' for Windows bind mounts in docker. Use when -v with a Windows path is rejected, usually from backslash vs slash or drive-letter formatting. Not for Linux bind paths or named-volume character errors.
TL;DR: Format the Windows path the way docker expects: forward slashes and lowercase drive, like -v c:/data URIs/data, or quote the path. Backslashes and unquoted drive letters break the volume parser. On Docker Desktop for Windows, -v C:\data URIs/data fails while -v c:/data URIs/data works.
The error
docker: Error response from daemon: invalid volume specification: 'C:\data URIs/data URIsrw': invalid volume specification.Fix it
- Rewrite the bind with forward slashes:
docker run -v c:/data URIs/data [image] Expected: container starts.
- In PowerShell, quote to stop the shell mangling the path:
docker run -v "c:/data URIs/data" [image] Expected: works.
- From Git Bash/MSYS, use the posix-style path or double slashes:
docker run -v //c/data URIs/data [image] Expected: works.
When this applies
- Docker Desktop on Windows with -v or --mount bind paths
- CI on windows-latest runners
When this does NOT apply
- Linux hosts (bind paths are native there)
- "includes invalid characters for a local volume name" (named volume rule, separate skill)
Versions
Docker Desktop 4.x on Windows.
Why it happens
The volume spec parser splits on : and treats backslashes as escapes. C:\data parses into something the validator rejects, while c:/data splits cleanly into source and destination.
Edge cases
- File sharing must be enabled for the drive in Docker Desktop Settings > Resources > File Sharing, or the bind silently shows an empty dir.
- WSL2 backend: prefer paths inside the WSL distro (
[HOME]/...) over /mnt/c; they are much faster. --mount type=bind,source=c:/data,target=/datais stricter but gives clearer errors than -v.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.