Can I specify a "service" in docker-compose.yml that doesn't start on "docker-compose up"?

Viewed 30

I'd like to be able to specify a "service" in my docker-compose config that is only used for "docker-compose run" commands.

My use-case is that I want to start a Kafka broker, and an application that uses it, but then start one-off "testutils" containers to interact with it, e.g.

services:
  
  broker:
    image: confluentinc/cp-server:6.2.0
    ...

  app:
    build: 
      context: ./myapp
    depends_on:
      - broker
    ...

  testutils:
    image: confluentinc/cp-kafkacat
    depends_on:
      - broker
   ...

and then

docker-compose run testutils kcat -q -t test-topic
0 Answers
Related