Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

379
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda