Resolve the docker error “while creating mount source path … no such file or directory” in Windows

Recently when I try to run my docker containers using “docker-compose up” command, it suddenly shows an error:

ERROR: for wh_ser_website_1 Cannot start service ser_website: error while creating mount source path ‘/c/dev_projects/…./services/website/source ‘ : chown ‘/c/dev_projects/…//services/website/source’ no such file or directory

This is actually coming from my docker-compose.yml file:

volumes:
    - ./services/website/source:/var/www/html

The first reaction I had was to check the folder path if there is any typo or accident deletion.  But every file/folder is just sitting there perfectly fine.

Secondly, I checked my share drive in docker settings, the C: drive has already been checked. No issue about it.

This error has never happened before, and those containers were running perfectly a few days ago.  Nothing has been changed except that I created symbolic links to better organize my projects, and that is the reason.

Here is the thing. The project folder is actually stored in X:\PersonalDir\Cloud\Projects\…..\services\website\source.  The path is just too long and I hate to go down many levels to find my files, so I reorganized my project folders by creating a virtual folder in C:\dev_projects using symbolic link to link to X:\PersonalDir\Cloud\Projects . This gives me the convenience to access all my project folders quicker without really moving my actual project folders and files in X:  as shown below.

When I run “docker-compose up” in the virtual folder C:\dev_projects\, the above error occurs. I suppose this is because docker is going to access the folder from C:\dev_projects but is actually stored in X: .

When I change to the project folder in X: drive and run the command again, the error is gone. Problem solved.

Base on this experience, I believe there is an issue in docker to work with Windows symbolic link at the current version.

Hope this helps anybody in such situation.

2 Replies to “Resolve the docker error “while creating mount source path … no such file or directory” in Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *