My question is specific to the Docker for Windows. The version I'm using is 17.03.1-ce-rc1-win3 (10625) on Windows 10 Pro x64.
I'm trying to create an image where I need to copy a folder into the "Program Files (x86)" folder in my container based on microsoft/dotnet-framework:3.5 image.
My Dockerfile is super simple ...
# escape=`
FROM microsoft/dotnet-framework:3.5
COPY ["TestFolder", "C:\Program Files (x86)\TestFolder"]
Running docker build
, I ended up
Step 2/2 : COPY ["TestFolder", "C:\Program Files (x86)\TestFolder"]
GetFileAttributesEx C:\Program: The system cannot find the file specified.
It looks like docker mistakenly stopped parsing the dest name at the first whitespace. However this COPY ["<src>", ..."<dest>"]
is exactly the syntax for dealing the paths containing whitespace (ref). And if I use any other folder name like "Foo Bar" instead, the COPY instruction just works as expected.
So my current workaround is using WORKDIR first to change the working dir to the "Prog...(x86)" folder and then doing COPY without explicitly giving the full dest path.
But I really would like to know if I did anything wrong with the COPY instruction.
Thanks.
You have to use double backslashes inside the braces
FROM microsoft/windowsservercore
COPY ["test.txt", "c:\\program files\\WindowsPowerShell\\Modules\\test.txt"]
It is interpreted as JSON.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With