Are you trying to mount a directory onto a file (or vice-versa)? In my case I had accidentally mapped a directory from the host to a file in the container Restarting the container didn't work anymore I had to remove the container (docker rm …), then recreate it
not a directory: unknown: Are you trying to mount a directory onto a . . . Check if the specified host path exists and is the expected type I have tried a few things to try and resolve the issue: Removing the container and the volumes and trying again and I have tried mounting the directory and that worked fine - for some reason it's failing on single files?
Bind mounts | Docker Docs When you use a bind mount, a file or directory on the host machine is mounted from the host into a container By contrast, when you use a volume, a new directory is created within Docker's storage directory on the host machine, and Docker manages that directory's contents Bind mounts are appropriate for the following types of use case:
Problem mounting files - Docker Desktop - Docker Community Forums You can try running the command in the folder of the file you want to mount so you can rule out that you accidentally have a typo in the filepath or there is a non-printable character in the path which still have a result of trying to mount a different file
Docker compose Caddy Error mounting file in a directory : Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Encountered errors while bringing up the project