Answers: <h2>Using Docker with Windows Paths</h2>
  <p>Docker uses the dot notation (<strong>:</strong>) as container name and path separator.</p>
  <p>Consider the following Docker command:</p>
  <pre><code>docker cp D:\site\spering-html webserver:/usr/share/nginx/html
  </code></pre>
  <p>In this case, Docker attempts to resolve the command by looking for a container named &quot;D&quot; and trying to copy its internal contents from &quot;\site\spering-html&quot;. However, since there is no container named &quot;D&quot;, an error is thrown.</p>
  <h2>Solution</h2>
  <p>To resolve this issue, you can modify the command to wrap the Windows path in double quotation marks, like this:</p>
  <pre><code>docker cp &quot;D:\site\spering-html&quot; webserver:/usr/share/nginx/html
  </code></pre>
  <p>Here, you force the Docker interpreter to treat the the first argument as a (Windows/filesystem) path, rather than a container name. Also as you know the second one(i.e. <code>webserver:/usr/share/nginx/html</code>) is the container name and path inside it.</p>
  <h2>Additional Resources</h2>
  <p>For more information on this topic, you can refer to the following related answer:</p>
  <ul>
  <li><a href="https://stackoverflow.com/a/49393168/7508077">https://stackoverflow.com/a/49393168/7508077</a></li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2024-10-06T08:45:10.313Z
Answers: 2024-12-29T07:43:53.400Z
Answers: 2024-12-29T07:43:53.400Z
Answers: EsmaeelE
Body: <p>I'm trying to do an activity in Docker that my teacher requested but I'm having difficulty completing it.</p>
  <p>He asked to create 3 containers, one of them called &quot;webserver&quot; and to upload a folder containing a website's files into this container and then run the website at localhost:8080.</p>
  <p>But I'm having trouble uploading the folder to the container, here's what I did:</p>
  <pre><code>docker cp D:\site\spering-html webserver:/usr/share/nginx/html
  </code></pre>
  <p>the folder I want to upload is located on my pendrive D: and inside the site folder. I also tried the command</p>
  <pre><code>docker cp D:\site\spering-html\. webserver:/usr/share/nginx/html
  </code></pre>
  <p>adding a . in the end, but regardless of what I did the terminal always returned: <strong>copying between containers is not supported</strong>. I just can't identify the error, could someone explain it to me?</p>
  <p>Note: translated text</p>
  
Comments: CC BY-SA 4.0
Comments: 2024-10-06T08:35:47.933Z
Comments: Are you using windows `CMD` to run docker command?
Comments: EsmaeelE
Tags: <docker><nginx>
Title: Docker cp command error
UserDisplayName: Tavinho
ThreadText: # Docker cp command error
  
  (Asked by: username_0 on 2024-10-01)
  
  I'm trying to do an activity in Docker that my teacher requested but I'm having difficulty completing it.
  
  He asked to create 3 containers, one of them called "webserver" and to upload a folder containing a website's files into this container and then run the website at localhost:8080.
  
  But I'm having trouble uploading the folder to the container, here's what I did:
  
  ```
  docker cp D:\site\spering-html webserver:/usr/share/nginx/html
  
  ```
  
  the folder I want to upload is located on my pendrive D: and inside the site folder. I also tried the command
  
  ```
  docker cp D:\site\spering-html\. webserver:/usr/share/nginx/html
  
  ```
  
  adding a . in the end, but regardless of what I did the terminal always returned: **copying between containers is not supported**. I just can't identify the error, could someone explain it to me?
  
  Note: translated text
  
  **Tags:** docker, nginx
  
  > **Comments:**
  > **username_1**: Are you using windows `CMD` to run docker command?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-10-06. Score: 2
  
  ## Using Docker with Windows Paths
  
  Docker uses the dot notation (**:**) as container name and path separator.
  
  Consider the following Docker command:
  
  ```
  docker cp D:\site\spering-html webserver:/usr/share/nginx/html
  
  ```
  
  In this case, Docker attempts to resolve the command by looking for a container named "D" and trying to copy its internal contents from "\site\spering-html". However, since there is no container named "D", an error is thrown.
  
  ## Solution
  
  To resolve this issue, you can modify the command to wrap the Windows path in double quotation marks, like this:
  
  ```
  docker cp "D:\site\spering-html" webserver:/usr/share/nginx/html
  
  ```
  
  Here, you force the Docker interpreter to treat the the first argument as a (Windows/filesystem) path, rather than a container name. Also as you know the second one(i.e. `webserver:/usr/share/nginx/html`) is the container name and path inside it.
  
  ## Additional Resources
  
  For more information on this topic, you can refer to the following related answer:
  
  * <https://stackoverflow.com/a/49393168/7508077>
  
  
  ---
  
  