Profiles - matching services by query

Harbor 2.0 introduced Service Profiles to make operating only on selected services possible. The profiles are selectors that picks services you want to operate on.


  • Secure. Services that should not be touched are not touched
  • Handy. Can be used in harbor :deployment:apply task when deploying to production environment to update only part of services (eg. all instances of data collecting application)
  • Flexible. The syntax of the filter is pure Python, you can create as much advanced queries as far as you would be able to understand them :)


Given we have a “gateway” selector, that picks all services that name begins with “gateway_”



Now we can use it in all service management and environment stop/start tasks, for example harbor :start --profile=gateway


Variable Description
name Name of the service (string)
service Service attributes, docker-compose definition (dict)


  • Always check every node in dictionary for existence - Example: 1) labels, 2) labels.some-label

Advanced example:

"labels" in service and "" in service['labels'] and service['labels'][''] == "database"