I am trying to start multiple services with docker-compose but I get
npm ERR! missing script: start
in my console when I run the docker-compose up command
Note I am able to start the each of the services individually with docker run command.
Below is a copy of my docker-compose.yml file
version: '3.4'
services:
clientservice:
image: clientapplication
build:
context: .
dockerfile: ./client/Dockerfile
environment:
NODE_ENV: production
ports:
- "3000:3000"
networks:
- blogmicroservice
commentservice:
image: commentsservice
build:
context: .
dockerfile: ./comments/Dockerfile
environment:
NODE_ENV: production
ports:
- "4001:4001"
networks:
- blogmicroservice
moderationservice:
image: moderationservice
build:
context: .
dockerfile: ./moderation/Dockerfile
environment:
NODE_ENV: production
ports:
- "4003:4003"
networks:
- blogmicroservice
postservice:
image: postservice
build:
context: .
dockerfile: ./posts/Dockerfile
environment:
NODE_ENV: production
ports:
- "4000:4000"
networks:
- blogmicroservice
eventbusservice:
image: eventbus
build:
context: .
dockerfile: ./event-bus/Dockerfile
environment:
NODE_ENV: production
ports:
- "4005:4005"
networks:
- blogmicroservice
queryservice:
image: queryservice
build:
context: .
dockerfile: ./query/Dockerfile
environment:
NODE_ENV: production
ports:
- "4002:4002"
networks:
- blogmicroservice
networks:
blogmicroservice:
driver: bridge
An example of the docker file for individual service
FROM node:12.18-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production --silent
COPY . .
EXPOSE 4002
CMD ["npm", "start"]
npm install? The start script should be in package.json, so that's strange that docker-compose can run install but cannot find start scriptnpm install?