<!--
  canonical-url: https://www.avonture.be/blog/docker-name-property
  published:     2025-10-10
  This is a static plain-Markdown mirror generated at build time.
  Visit the canonical URL above for the fully rendered page, with images and interactive components.
-->

# Docker - How to group containers together

> Learn how to organize Docker containers into logical groups using compose.yaml for a cleaner workflow.

---
![Docker - How to group containers together](/img/v2/docker_tips.webp)

**TL;DR**

This article provides a quick tip for organizing your containers in Docker Desktop. It explains how to use the top-level `name` property in your `compose.yaml` files to group related services together under a single, collapsible entry in the Docker Desktop UI. This simplifies management, allowing you to start and stop multiple containers at once and keep your workspace tidy. The post also notes that this is a UI feature and suggests converting `docker run` commands to a compose file to take advantage of it.

On a daily basis, I'm running several tools as Docker containers: [Heimdall](/blog/heimdall-dashboard), [Memos](/blog/docker-memos) and [Karakeep](/blog/docker-karakeep). It can be one or more containers per tool.

I'm working under Windows so I'm using Docker Desktop to get a list of containers and, because I'm working with Docker for my own projects (can be Python, PHP or whatever), I'm facing the following situation: I have a big list of containers and I would like some order.

Tools like Heimdall, Memos and Karakeep, I'm using them to make my daily work easier and it would be nice if I could group them together.

See below: I'm grouping tools of different origin under `Tools` so it's easier to manage them.

![Grouping tools](./images/grouping_tools.webp)

This way, I have a smaller overview of the containers and can quickly sort out my tools and projects.  Also, if the need arises, I can stop all the tools at once. That's handy.

## The name property in the compose.yaml file

The solution is easy to implement: if you have a `compose.yaml` (or `docker-compose.yml` if using the old name convention), just add a `name: tools` entry in the file, at the top.

For instance:

**compose.yaml**

```yaml
// highlight-next-line
name: tools

services:
  memos:
    image: neosmemo/memos:stable
    container_name: memos
    init: true
    ports:
      - "5230:5230"
    volumes:
      - ./data:/var/opt/memos
    restart: unless-stopped
```

And that's all.

*Another way to keep a long list of containers manageable, this time from the terminal rather than from Docker Desktop: the interactive `fzf`-based functions of [ZSH Functions - Customizing Your Shell for Docker Management](/blog/zsh-docker-functions).*

Now, by running `docker compose up --build --detach`, you'll see your containers will be grouped in `tools` (only visible in the Docker Desktop Windows software; not using the `docker ps` command).

Do the same for every tool you want, if there is a `compose.yaml` file, just add the `name: tools` top-level entry.

But what if you don't have a YAML file and you're using a `docker run` command instead? There is indeed a `--name` flag with `docker run` but it's for naming the container (equivalent to the `container_name` entry thus).

So, if you're running `docker run [something]` you'll have to convert the line to a YAML file. Any AI can do that. Just copy/paste your full `docker run [something]` command and ask it to convert it to a `compose.yaml` file.

Easy and really handy.

*No `compose.yaml` either because the container is a VS Code devcontainer? Two `runArgs` give it the same grouping: see [Devcontainer - Name Your Container and Group It in Docker Desktop](/blog/devcontainer-container-name).*

## Tools can be located in different folders

Just to say, you can put your files, volumes, ... in different folders, it doesn't matter. On my disk, I have a `~/tools` folder with one directory per tool (one for Heimdall, one for Memos, one for Karakeep, ...) and it's not a problem at all.

This lets me store files and volumes properly.
