I try to run a container from a built image and get an error /bin/sh: =:. Is there anyone know how to fix it. Below is my Dockerfile. Both the index.js and package.json are in the same folder with the Dockerfile.
package.json
{
"dependencies":{
"express":"*"
},
"scripts":{
"start":"node index.js"
}
}
Dockerfile
FROM node:14.4.0-alpine3.10
COPY ./ ./
RUN npm install
CMD = ['npm', 'start']
The input to CMD
is parsed as a JSON array, which means you have to use double quotes and not single quotes. Additionally, get rid of the =
CMD ["npm", "start"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.