I did several searches of the internet and this forum and finally I found Using Bind Mounts: error Couldn’t find a package.json file in “/app” · Issue #76 · docker/getting-started. The last response is the important one. The
docker-compose.yml file must be in the
app directory. The tutorial says the root of the app project and that is easily misunderstood. The fact that there is a
docker-compose.yml file in the top directory contributes to the confusion.
I am using Windows 10 Home.
I have been using the Get started tutorial. I got to Use Docker Compose and it was not working so I downloaded a fresh copy of the application. It already has a
docker-compose.yml, right? And we are to replace the contents with the contents in the tutorial, right? And then execute the
docker-compose up command from the root directory, the directory containing the
app directory, right? It seems to work. Everything looks good in the log, except at the bottom it says:
error Couldn't find a package.json file in "/app"
Is the preceding correct? If so then what more information do you need to diagnose the problem?
The tutorial uses the application in docker/getting-started: Getting started with Docker. The following is the contents I have for the
version: "3.7" # services: # docs: # build: # context: . # dockerfile: Dockerfile # target: dev # ports: # - 8000:8000 # volumes: # - ./:/app services: app: image: node:12-alpine command: sh -c "yarn install && yarn run dev" ports: - 3000:3000 working_dir: /app volumes: - ./:/app environment: MYSQL_HOST: mysql MYSQL_USER: root MYSQL_PASSWORD: secret MYSQL_DB: todos mysql: image: mysql:5.7 volumes: - todo-mysql-data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: todos volumes: todo-mysql-data: