apple / apple/container

[Bug]: `container run --label` rejects a label whose value contains "="

Open Beginner friendly
#1,977 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Steps to reproduce

```
container run --rm --label 'config=key=value' alpine true
```

### Current behavior

```
Error: invalid label format config=key=value
```

Any `--label KEY=VALUE` whose value contains a `=` is rejected — for example a reverse-proxy router rule (`--label 'traefik.http.routers.x.rule=Host(\`ex.com\`)'`) or a nested `key=value` configuration value. A label with no `=` in the value works.

### Expected behavior

The label is accepted with the value kept intact (`key=value`), matching `docker run --label`, which splits the label on the first `=` only.

### Root cause

`Parser.labels` splits each entry with `label.split(separator: "=", maxSplits: 2)` and only handles 1 or 2 parts, throwing for anything else. A value containing `=` produces 3+ parts and hits the `default` (throw) branch. It should split on the first `=` only — the env-file parser already does this (`URL=https://foo.bar?baz=woo` is accepted).

### Environment

- container 1.1.0
- macOS 26.5 (Tahoe), Apple Silicon

Contributor guide

Open the contributing guide

Research direction

Start at Parser.labels and compare its splitting behavior with the env-file parser, which accepts values such as URL=https://foo.bar?baz=woo. Run the reported container run command and verify that the label is accepted with key=value preserved intact, matching docker run behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.