Skip to content

Automatically group Docker Swarm stack containers#506

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-support-for-swarm
Draft

Automatically group Docker Swarm stack containers#506
Copilot wants to merge 2 commits into
mainfrom
copilot/add-support-for-swarm

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Docker Swarm stack containers carry the com.docker.stack.namespace label but lack com.docker.compose.project, so they appeared as ungrouped "individual containers" instead of grouping by stack like Compose projects do. Users had to manually configure groupBy: Label + groupByLabel: com.docker.stack.namespace as a workaround.

Changes

  • Grouping (ContainerProperties.ts): The default Compose Project Name grouping now falls back to the Swarm stack namespace label, so stack containers group under their stack name with no configuration. Extracted into a getComposeProjectGroup helper:

    export function getComposeProjectGroup(container: ListContainersItem): string {
        return getLabelGroup(container, composeProjectLabel, '')
            || getLabelGroup(container, swarmStackNamespaceLabel, NonComposeGroupName);
    }
  • Group commands (ContainerGroupTreeItem.ts): Compose-only commands (start/stop/restart/down/logs) require compose files that Swarm stacks don't have. contextValue now gates the composeGroup context on isComposeProjectGroup(), so these commands surface only for real Compose projects; stack groups still expand by default and keep the orchestration icon.

  • Updated the Compose Project Name property description, added unit tests for the grouping cases (compose / swarm / both / standalone), and added a CHANGELOG entry.

Note

The issue also mentioned stack-name prefixes in container names feeling redundant. This mirrors Compose exactly (e.g. project-service-1 grouped under project), which the extension intentionally does not strip, so naming is left unchanged for consistency.

Copilot AI changed the title [WIP] Add support for docker swarm container grouping Automatically group Docker Swarm stack containers Jun 17, 2026
Copilot AI requested a review from bwateratmsft June 17, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants