The error message means that npm can’t find a package.json file which includes a script named start. So make sure that your package.json contains a script named start! Might already be the issue.
// Simple package.json example that contains a script with name test.
{
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
},
}
When you look at the tutorial’s dockerfile:
This makes sure that the commands are executed in a specific folder, e.g. copying files:
Set the working directory.
WORKDIR /usr/src/app
This makes sure that the package.json file is copied into the workdir:
Copy the file from your host to your current location.
COPY package.json .
Here it defines that npm start will be executed when you run the container:
Run the specified command within the container.
CMD [ “npm”, “start” ]
To further investigate I would execute the following command to start the container:
docker run -it -d /bin/sh
Then go to the workdir and check if the app can be started manually:
Go to workdir
cd /usr/src/app
Here check if the package.json is part of the directory.
ls
Manually run npm script
npm start