I am trying to create a Dockerfile that adds a folder that I have somewhere on the my local windows filesystem to a windows container. However, I have trouble figuring out the correct syntax.
Specifically, I am trying to copy the contents of the directory [C:\Foo Source Files\Zog Foo\Bar] to [C:\Bar] on in the Windows Docker container.
Thus far, I have attempted the following variants:
ADD ["C:\Foo Source Files\Zog Foo\Bar", "C:/Bar"]
ADD ["C:\Foo Source Files\Zog Foo\Bar\", "C:/Bar/"]
These caused the following error when trying to run build the image:
failed to process "[\"C:\\Foo": unexpected end of statement while looking for matching double-quote
By contrast, the following variants...
ADD ["C:/Foo Source Files/Zog Foo/Bar", "C:/Bar"]
ADD ["C:/Foo Source Files/Zog Foo/Bar/", "C:/Bar/"]
ADD ["C:\\Foo Source Files\\Zog Foo\\Bar\\", "C:/Bar/"]
ADD ["C:\\\\Foo Source Files\\\\Zog Foo\\\\Bar\\\\", "C:/Bar/"]
ADD ["C:\\\\Foo Source Files\\\\Zog Foo\\\\Bar", "C:/Bar/"]
ADD C:/Foo Source Files/Zog Foo/Bar/, C:/Bar/
ADD C:\Foo Source Files\Zog Foo\Bar\, C:/Bar/
...caused the following differing error:
ADD failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder997952273\Foo Source Files\Zog Foo\Bar: The system cannot find the path specified.
This variant...
ADD C:\Foo Source Files\Zog Foo\Bar\, C:/Bar/
...caused this slightly different error:
ADD failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder997952273\Foo: The system cannot find the path specified.
After that, I tried to drop rename my source folders so they didn't contain any whitespaces, and tried it with this statement:
ADD C:\FooSourceFiles\ZogFoo\Bar\, C:/Bar/
...but that only resulted in the following error again:
ADD failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder197358441\C:FooSourceFilesZogFooBar,: The system cannot find the file specified.
I also tried it with extra slashes as escape character...
ADD C:\\FooSourceFiles\\ZogFoo\\Bar\\, C:/Bar/
...but that also failed since apparently Docker is looking for the file in a subdirectory of the docker working directory, even though I tried to instruct it to look in an absolute path
ADD failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder492157702\FooSourceFiles\ZogFoo\Bar\,: The system cannot find the path specified.
Any help with this would be greatly appreciated.
Edit: Explanation why this is not a duplicate of Dockerfile COPY instruction failing?: That question is about a COPY instruction failing that turned out to be because of "~/" not working, and it also is about Linux containers. My question is primarily about the correct syntax for using the ADD command on Windows containers. I don't see how these two issues are related, and the approved answer on that topic does not even apply to my case.