# Docker Sharing Source Code via Windows

**URL:** <https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168>\
**Category:** Uncategorized\
**Created:** [May 27, 2021, 8:39pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168 "2021-05-27T20:39:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gagglepod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/gagglepod/32/508_2.png) [@gagglepod](https://forum.codewithmosh.com/u/gagglepod)\
**Post date:** [May 27, 2021, 8:39pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/1 "2021-05-27T20:39:57Z")

</div>

Windows 10 machine running Docker Desktop via WSL2…  
Using Cmder shell tool for Windows.

TL;DR:  
Running these docker commands all fail to detect the source code change.  
Creating a new container does show the change from the previous attempt.  
But none of the following attempts showed changes while the container was running.

Attempt #1:  
docker run -d -p 5001:3000 --name wind-sock -v ${pwd}:/app react-app

Result #1:  
docker: Error response from daemon: create ${pwd}: “${pwd}” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9\_.-]” are allowed. If you intended to pass a host directory, use absolute path.

Attempt #2:  
docker run -d -p 5001:3000 --name wind-sock -v ${PWD}:/app react-app

Result #2:  
docker: Error response from daemon: create ${PWD}: “${PWD}” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9\_.-]” are allowed. If you intended to pass a host directory, use absolute path.

Attempt #3:  
docker run -d -p 5001:3000 --name wind-sock -v “%cd%”:/app react-app

Result #3:  
The container created successfully. However, when you make a change to react-app/public/index.html – nothing happens.

Attempt #4:  
docker run -d -p 5001:3000 --name wind-sock -v //c/x-apps/docker-work/react-app:/app react-app

Result #4:  
The container created successfully. However, when you make a change to react-app/public/index.html – again, nothing happens.

Attempt #5:  
docker run -d -p 5001:3000 --name wind-sock -v c:\x-apps\docker-work\react-app:/app react-app

Result #5:  
The container created successfully. However, when you make a change to react-app/public/index.html – yet again, nothing happens.

Any thoughts?

Cheers,  
Kyle

---

<div class="post-metadata">

**Author:** ![gagglepod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/gagglepod/32/508_2.png) [@gagglepod](https://forum.codewithmosh.com/u/gagglepod)\
**Post date:** [May 27, 2021, 8:54pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/2 "2021-05-27T20:54:48Z")

</div>

Opened up Powershell and tried:  
docker run -d -p 5001:3000 --name wind-sock -v ${PWD}:/app react-app

Nope. Only when the container restarted did it show the change.  
Powershell had no impact on runtime changes. ☹

Still searching for a solution…

---

<div class="post-metadata">

**Author:** ![gagglepod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/gagglepod/32/508_2.png) [@gagglepod](https://forum.codewithmosh.com/u/gagglepod)\
**Post date:** [May 28, 2021, 1:47am UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/3 "2021-05-28T01:47:11Z")

</div>

Uploaded the latest Docker Desktop v3.3.3 – No impact.

Then I found a few more versions of the syntax:

Attempt #6  
docker run -d -p 5001:3000 --name wind-sock -v /$(pwd):/app react-app

* * *

Attempt #7  
Using PowerShell  
MSYS\_NO\_PATHCONV=1 docker run -d -p 5001:3000 --name wind-sock -v /c/x-apps/docker-work/react-app:/app react-app

* * *

Attempt #8  
Using GIT Shell  
winpty docker run -d -p 5001:3000 --name wind-sock -v /$(pwd):/app react-app

* * *

Attempt #9  
docker run -v C:\x-apps\docker-work\react-app:/app -d -p 5001:3000 --name wind-sock react-app

Attempt #10  
docker run -v /c/x-apps/docker-work/react-app:/app -d -p 5001:3000 --name wind-sock react-app

I still cannot repeat the updated behavior Mosh was able to create in the video.  
Some of these Attempts create stable containers – some do not.  
But none of them allow me to change the TITLE tag and see an instant update in the browser.  
I have to restart the container to get anything new to show up.

I’m stumped…

Why won’t it update instantly as it does in Mosh’s video?  
Permissions? Do I have to share the folders? Tried that. Nothing.  
Do I have to only use the USER folders? That means moving the entire project. That doesn’t seem realistic.  
Is there something blocking the connection?  
No. Because the React app shows up once the container finishes loading.

So what is the deal? Arrggg… so frustrated with this tiny problem.

---

<div class="post-metadata">

**Author:** ![kitdev](https://avatars.discourse-cdn.com/v4/letter/k/b9e5f3/32.png) [@kitdev](https://forum.codewithmosh.com/u/kitdev)\
**Post date:** [June 2, 2021, 8:23pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/4 "2021-06-02T20:23:59Z")

</div>

man could you send to me vidly project that attached to docker course to test if we have same errors ?  
email: [khiterab31@gmail.com](mailto:khiterab31@gmail.com)

---

<div class="post-metadata">

**Author:** ![acmethod](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@acmethod](https://forum.codewithmosh.com/u/acmethod)\
**Post date:** [December 23, 2021, 8:39pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/5 "2021-12-23T20:39:19Z")

</div>

I’m having the same issue i’ve been using the following command

```auto
 docker run -d -p 5005:3000 -v ${pwd}:/app react-app

```

The files indeed get updated in the container, but no reflection of changes unless i stop and restart the container.

Someone else mentioned it could have something to do with nodemod?

I’m stumped.

---

<div class="post-metadata">

**Author:** ![acmethod](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@acmethod](https://forum.codewithmosh.com/u/acmethod)\
**Post date:** [December 24, 2021, 7:02pm UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/6 "2021-12-24T19:02:46Z")

</div>

The following solution worked for me for getting the react app to hot reload

> **[How To Hot Reload Auto Refresh React App On Wsl](https://mbuotidem.github.io/blog/2021/01/09/how-to-hot-reload-auto-refresh-react-app-on-WSL.html)**
>
> If you’re working on a React app on Windows using Windows Subsystem for Linux (WSL), you might find that your app does not reflect your changes on save.

Snippet from the page above:

You can create a `.env` file in your project directory if you don’t already have one and add

`CHOKIDAR\_USEPOLLING=true  
FAST\_REFRESH=false

`to the `.env` file.

Or you can edit your `package.json` file like so:  
{  
“scripts”: {  
“start”: “`CHOKIDAR\_USEPOLLING=true FAST\_REFRESH=false react-scripts start”,  
“build”: “react-scripts build”,  
“test”: “react-scripts test”,  
“eject”: “react-scripts eject”  
}  
}

---

<div class="post-metadata">

**Author:** ![Tarek](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@Tarek](https://forum.codewithmosh.com/u/Tarek)\
**Post date:** [August 26, 2023, 3:15am UTC](https://forum.codewithmosh.com/t/docker-sharing-source-code-via-windows/5168/7 "2023-08-26T03:15:36Z")

</div>

The only way it worked for me is to switch and copy everything to linux using WSL:

> [@Hot Reload not working in React 17.0.3](https://forum.codewithmosh.com/t/hot-reload-not-working-in-react-17-0-3/5606/5):
>
> If you are on Windows, then we maybe have the same issue. After hours of researching and digging everywhere I found the solution. You need to open a linux WSL instance and copy all of the project source code there and run all the commands in the bash or shell. The way I did it: In VS code go to the plugin Remote Explorer If you don’t already have it, install it in vs code: VS Marketplace Link: [Remote Explorer - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-explorer) Press on + to add a distro (I’ve added ubuntu latest…
