如何在Docker文件中使用带有空格的路径 [英] How to use the path with the space in docker file

查看:596
本文介绍了如何在Docker文件中使用带有空格的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在docker文件中编写一个cmd,以将文件复制到目标 C:\windows\Program Files 。由于程序文件中的空间,我遇到了一个问题。我可以将文件复制到其他位置。任何建议将不胜感激。

I want to write a cmd in docker file to copy the file at the destination C:\windows\Program Files. I am having an issue due to space in program files. I am able to copy the file to different location. Any suggestion will be appreciated.

我遇到以下错误:

第4步:复制 C:\ \docker\先决条件\MicrosoftSDKs C:\Program Files
(x86)\MicrosoftSDKs

Step 4 : COPY "C:\docker\prerequisites\MicrosoftSDKs" "C:\Program Files (x86)\MicrosoftSDKs"

构建上下文之外的禁止路径:C :\docker\前提条件\MicrosoftSDKs
()

Forbidden path outside the build context: C:\docker\prerequisites\MicrosoftSDKs ()

推荐答案

使用JSON表单,您必须使用大括号内的双反斜杠

Use the JSON form, you have to use double backslashes inside the braces

FROM microsoft/windowsservercore 
COPY ["C:\\docker\\prerequisites\\MicrosoftSDKs", "C:\\Program Files (x86)\\MicrosoftSDKs"]

您也可以使用斜杠:

COPY ["C:/Program Files/nodejs", "/windows/system32"]

这篇关于如何在Docker文件中使用带有空格的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆