Docker Community Forums

Share and learn in the Docker community.

Exclude services from being started with docker-compose using profiles?

My docker-compose.yml defines multiple services which represent the full application stack. In development mode, I’d like to dynamically exclude certain services, so that I can run them from an IDE.

As of Docker Compose 1.28 it is possible to assign profiles to services as documented here but as far as I have understood, it only allows specifying which services shall be started, not which ones shall not get started.

In the end I’d like to achieve something like this (pseduo command):

docker-compose up --exclude service1,service2

Do you have any recommendations on how to exclude certain services? Would that be possible using Docker Compose profiles?