Using docker run with $(pwd) on Windows/Powershell

Just a tip if you are using PowerShell on Windows, the following command as per Lesson 11 on Working with Containers:

docker run -d -p 5001:3000 -v $(pwd):/app react-app

does not work

Use this instead

docker run -d -p 5001:3000 -v ${PWD}:/app react-app

2 Likes

Along with this change to get the the react app to resoond to file updates live i also had to a .env file with these lines:

CHOKIDAR_USEPOLLING=true
FAST_REFRESH=false

Thank you. These two tips got me working. I went with the second method by editing the json, not really sure if one has advantages over the other.

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”
}
}