Monday 12 June 2017

docker compose run with command error

From this documentation, it seems like that I can execute a single command from a service like this:

docker-compose run SERVICE CMD

But when I run

docker-compose up pwa npm test

I get the error

ERROR: No such service: npm

From my configurations, it will execute npm start, but I'd like to know how to execute other commands.

Files

Dockerfile:

From node:8
WORKDIR /app
copy package.json /app/
RUN npm install --quiet
CMD npm start

docker-compose.yml:

version: '3'
services:
  pwa:
    build: .
    ports:
      - '3000:3000'
    volumes:
      - ./src:/app/src
      - ./public:/app/public

Versions

Docker version: 17.03

Docker compose version: 1.11.2



via Nelson Yeung

No comments:

Post a Comment