ProjectStack
docker

Error response from daemon: invalid mount config for type "bind": invalid mount path: mount path must be absolute

You specified a relative path for a volume mount, but Docker requires absolute paths for bind mounts on the host side. A path like ./data is relative and only works in Docker Compose (which expands it automatically) — not in docker run.

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

  1. Use an absolute path: docker run -v /home/user/myproject/data:/app/data myimage
  2. Use the shell expansion for the current directory: docker run -v $(pwd)/data:/app/data myimage
  3. In Docker Compose, relative paths work fine — use ./ prefix and Compose expands them
  4. 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.