Common causes
- Using a relative path (./data, ../config) in a docker run -v flag instead of an absolute path
- A docker-compose.yml using relative paths that was copied directly into a docker run command
- A typo or missing / at the start of the host path
- An environment variable expansion that produces a relative path
How to fix it
- Use an absolute path: docker run -v /home/user/myproject/data:/app/data myimage
- Use the shell expansion for the current directory: docker run -v $(pwd)/data:/app/data myimage
- In Docker Compose, relative paths work fine — use ./ prefix and Compose expands them
- Use a named volume instead of a bind mount if you don't need to map a specific host directory: docker run -v mydata:/app/data myimage
Example
$ docker run -v ./data:/app/data myapp
docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'data' mount path must be absolute.Relative path ./data used in docker run -v — Docker requires an absolute path here
Browse more errors
The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.
