Docker build "Can't add file used by another process"

Problem - Docker build fails to setup the context

One of the first things docker build does is setup the "Context". I'm sure it's more complex than this, but it seems to copy all the non-ignored files to somewhere for later use.

I hit the following problem however:

level=error msg="Can't add file \\\\?\\C:\\repos\\TestBed\\Data\\Database.dbmdl to tar:
open \\\\?\\C:\\repos\\TestBed\\Data\\Database.dbmdl: The process cannot access
the file because it is being used by another process."
<1 line per file in the folder>
ERROR: Error processing tar file(exit status 1): unexpected EOF

Solution - .dockerignore dbml files

After a lot of dead ends, I ended up finding I'm going to forgive myself though, as that question even points out how overwhelming the error message is:

At first glance, the error message listed as a result of this is not easy to interpret, it lists all the files within the solution as having issues, when in reality the first problem it encounters causes a splurge of errors.

Like a lot of things in technology, simple when you know how.

Comments Section