i will docker my app js. I run the order docker-compose up. But i have error : app | /bin/sh: 1: [: “npm”,: unexpected operator.
Dockerfile
FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
RUN ["npm", "start" ]
docker-compose.yml
version: "2"
services:
app:
container_name: app
restart: always
build: .
ports:
- "3000:3000"
links:
- mongo
mongo:
container_name: mongo
image: mongo
volumes:
- ./data:/data/db
ports:
- "27017:27017"
Double-check your Dockerfile.
"npm"
is different from“npm”
, notice the double quote"
and“
. You should always use"
(input from your keyboard) rather than“
then run the following command: