Sergei Basharov
Sergei Basharov

Reputation: 53938

How to skip executing a single service with docker-compose?

I have docker-compose.yml file with a set of services inside. In some cases for development I want docker not to start on of services which is a helper one when I run docker-compose up.

Is it possible to do and if so, how to?

Upvotes: 3

Views: 895

Answers (2)

stormwild
stormwild

Reputation: 2955

A possible workaround would be to add a profile to the service

Using profiles with Compose | Docker Docs

version: '3.7'
services:
  someservice:
    image: someimage
    profiles: [profile-to-exclude]

If all the rest of the services have no profile assigned, then all services except for the one with a profile will be run.

docker compose up -d

Runs all services except the one with a profile.

Upvotes: 1

Opal
Opal

Reputation: 84894

I suppose this is still not implemented yet, see the discussion here.

Upvotes: 2

Related Questions