'Docker : Error response from daemon: user declined directory sharing

While trying to run this command :

docker-compose up

I get this error :

Error response from daemon: user declined directory sharing C:\Users\path_to_my_folder

I am working on windows 10



Solution 1:[1]

You have to add C:\Users\path_to_my_folder to Docker Filesharing. Go to docker dashboard -> settings ->Resources -> FileSharing. Add required folder and hit Apply & Restart.

Solution 2:[2]

Normally, Docker will display a desktop notification asking for your confirmation before sharing the folder.

Docker sharing confirmation notification

However, if notifications are disabled (for example, if you enabled Focus Assist), the confirmation box won't show and Docker will automatically decline the permission.

Solution 3:[3]

Open Docker and follow this -> settings ->Resources -> FileSharing. Add required folder and hit Apply & Restart

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stefan Vukovic
Solution 2 Benoit Blanchon
Solution 3 Kamran Huseyn