Using Bind Mounts: error Couldn't find a package.json file in "/app"
See original GitHub issueI was having an issue completing the steps in Starting a Dev-Mode Container.
- Run the following command (if you are using PowerShell then use this command):
docker run -dp 3000:3000 ` -w /app -v “$(pwd):/app” ` node:12-alpine ` sh -c “yarn install && yarn run dev”
An image ID would be output in the shell, but examining the container using Docker Desktop revealed the container had exited with the following terminal output:
yarn install v1.22.4 [1/4] Resolving packages… success Already up-to-date. Done in 0.05s. yarn run v1.22.4 error Couldn’t find a package.json file in “/app” info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I had to update the command in step 2 to the following:
docker run -dp 3000:3000 ` -w /app -v “$(pwd):/app” ` node:12-alpine ` sh -c “cd app && yarn install && yarn run dev”
Is this an appropriate work around?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:49
- Comments:33
Top GitHub Comments
The tutorial mentions only once early on which directory you should run commands from when starting the tutorial, so it’s easy to miss.
We need to be inside the
app
directory.So after unzipping the getting-started tutorial we have something like d:\getting-started\app If running the
docker run
command from d:\getting-started\ you’ll get the above error.So
cd
into d:\getting-started\app and try the command again.Hi @MSoup , I am also new to docker today I faced same issue with windows 10 only,
my working directory is
E:\DockerPractice\getting-started\app
so what I did is
docker run -dp 3000:3000 -w //app -v "//e/DockerPractice/getting-started/app:/app" node:12-alpine sh -c "yarn install && yarn run dev"
this command works fine for me