The Ultimate Docker Course: 55th lesson on Windows 10

Good day everybody!

My issue relates to the last command of the 55-th lesson of Sharing the source code with a container

There is a command causing a trouble:
docker run -d -p 5001:3000 -v $(pwd):/app react-app
the same command may be executed in PowerShell as
docker run -d -p 5001:3000 -v ${PWD}:/app react-app

The problem with it is even though I did manage to create a new container Docker cannot run it.

I entered the following command to get a log file:
docker logs #containerId

Here’s the log:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /react-app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open ‘/react-app/package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /home/react-app/.npm/_logs/2021-06-24T16_26_31_797Z-debug.log

Then I tried to export the container to my local drive:

docker container export #containerId -o react-app

and opened another log file as it suggested:
/home/react-app/.npm/_logs/2021-06-24T16_26_31_797Z-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘start’ ]
2 info using npm@6.14.13
3 info using node@v14.17.1
4 verbose stack Error: ENOENT: no such file or directory, open ‘/react-app/package.json’
5 verbose cwd /react-app
6 verbose Linux 5.10.25-linuxkit
7 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “start”
8 verbose node v14.17.1
9 verbose npm v6.14.13
10 error code ENOENT
11 error syscall open
12 error path /react-app/package.json
13 error errno -2
14 error enoent ENOENT: no such file or directory, open ‘/react-app/package.json’
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -2, true ]

If you’re interested in a list of files inside of this archive, here is it

I uploaded the complete archive to a temporary cloud. If any one is good at Linux, please help to solve the issue!

Eventually a solution has been found. Once I reached 66-th lesson Publishing Changes in which we do almost the same though there would be a slightly different error relating to nodemon. Nonetheless the solution is the same! You mustn’t delete node_modules directory. Provided you did delete the directory, get rid of your containers and images, install all dependencies, as usual enter npm install command in the root of your app, then create a docker image and run a container sharing volumes between a container and your local machine.

In case you’re interested I recorded a short video which is available on YouTube