docker build Error checking context: 'can't stat '\\?\C:\Users\username\AppData\Local\Application Data''

docker build failed on windows 10,

After docker installed successfully, While building docker image using below command.

docker build -t drtuts:latest . Facing below issue. enter image description here

Kindly let me know if any one resolved same issue.


Solution 1:

The problem is that the current user is not the owner of the directory.
I got the same problem in Ubuntu, this line solves the issue:

Ubuntu

sudo chown -R $USER <path-to-folder>

Source: Change folder permissions and ownership

Windows

This link shows how to do the same in Windows:
Take Ownership of a File / Folder through Command Prompt in Windows 10

Solution 2:

Just create a new directory and enter it:

$ mkdir dockerfiles
$ cd dockerfiles

Create your file in that directory:

$ touch Dockerfile

Edit it and add the commands with vi:

$ vi Dockerfile

Fnally run it:

$ docker build -t tag .