---
url: https://dozzle.dev/guide/container-groups.md
description: >-
  How Dozzle groups Docker containers by Compose stack or Swarm service, and how
  to make custom groups with the dev.dozzle.group label, including on
  Kubernetes.
---

# Container Groups

Dozzle performs automatic grouping of containers based on their stack name or service name. You can also create custom groups using labels.

## Default Groups

By default, containers are grouped by their stack name in host mode. If `com.docker.swarm.service.name` label is present, Dozzle will automatically enable a "swarm mode" where all containers with the same service name will be joined together.

## Custom Groups

Additionally, you can create custom groups by adding a label to your container. The label is `dev.dozzle.group` and the value is the name of the group. All containers with the same group name will be joined together in the UI. For example, if you have a group named `myapp`, all containers with the label `dev.dozzle.group=myapp` will be joined together.

Here is an example using Docker Compose or Docker CLI:

::: code-group

```sh
docker run --label dev.dozzle.group=myapp hello-world
```

```yaml [docker-compose.yml]
services:
  dozzle:
    image: hello-world
    labels:
      - dev.dozzle.group=myapp
```

:::

## Kubernetes

In Kubernetes mode, the sidebar groups pods by namespace and owner. A `dev.dozzle.group` label or annotation on the pod template adds every container in the pod to a custom group as well. A label and an annotation behave the same, so use an annotation if the group name has spaces. When both are set, the annotation wins.

```yaml [deployment.yaml]
spec:
  template:
    metadata:
      labels:
        dev.dozzle.group: myapp
```
