Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
How to _directly_ COPY files to "Program Files (x86)" folder in a Windows container?

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.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report

0

Change the backslashes with forward slashes as per below, double backslash no longer works for me but the below should do it.

COPY ["TestFolder", "C:/Program Files (x86)/TestFolder"]
over 4 years ago · Santiago Trujillo Report

0

Change the backslashes with forward slashes as per below, double backslash no longer works for me but the below should do it.

COPY ["TestFolder", "C:/Program Files (x86)/TestFolder"]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!