Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the path with the space in docker file

Tags:

dockerfile

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.

I am getting below error:

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

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

like image 893
Meet101 Avatar asked Sep 02 '16 17:09

Meet101


People also ask

How do I navigate to a folder in docker?

Using the cd Command In Linux, the cd command is the standard way to change the directory for most use cases. On the same note, when working with some docker instructions such as RUN, CMD, and ENTRYPOINT, we can use the cd command to change the directory for the current command in context.

What is the path of docker container?

Within the virtual image, the path is the default Docker path /var/lib/docker .

How do I specify a Dockerfile volume?

Volumes can be declared in your Dockerfile using the VOLUME statement. This statement declares that a specific path of the container must be mounted to a Docker volume. When you run the container, Docker will create an anonymous volume (volume with a unique id as the name) and mount it to the specified path.

What is the use of Workdir in docker?

The WORKDIR command is used to define the working directory of a Docker container at any given time. The command is specified in the Dockerfile. Any RUN , CMD , ADD , COPY , or ENTRYPOINT command will be executed in the specified working directory.


1 Answers

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"]

You can also use slash:

COPY ["C:/Program Files/nodejs", "/windows/system32"]
like image 92
VictorV Avatar answered Sep 30 '22 16:09

VictorV