Bug when merging when TCP and UDP on the same published port
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia riproducendo il problema con compose.yaml e compose.override.yaml, quindi esegui docker stack config con entrambi gli ordini di unione. Traccia la gestione dell’unione dei file Compose da parte di Docker CLI per le porte dei servizi, inclusa la sintassi breve e quella estesa. Il lavoro è completato quando l’output unito conserva entrambe le voci TCP e UDP sulla porta pubblicata 443 quando l’override non definisce porte.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When merging multiple stack Compose files where one defines a service exposing TCP and UDP on the same published port (e.g., 443), the resulting merged configuration silently drops the first port entry. Even if the override doesn't specify ports. The only work-around I've found is to change the merge order but that's only a viable solution if you're not relying on overriding other values.
This violates the expected behavior where the ports array should remain unchanged if not explicitly overridden.
Reproduce
Given the following files:
# compose.yaml
services:
web:
image: caddy
ports:
- "80:80"
- "443:443" # adding /tcp here makes no difference
- "443:443/udp"
# compose.override.yaml
services:
web:
environment:
FOO: bar
Running the following command:
docker stack config -c compose.yaml -c compose.override.yaml
Returns the following:
version: "3.13"
services:
web:
environment:
FOO: bar
image: caddy
ports:
- mode: ingress
target: 80
published: 80
protocol: tcp
- mode: ingress
target: 443
published: 443
protocol: udp
Note that the 443 tcp entry is now gone.
The same is true when using long syntax.
Reversing the merge order leaves the ports array intact:
docker stack config -c compose.override.yaml -c compose.yaml
Returns the following:
version: "3.13"
services:
web:
environment:
FOO: bar
image: caddy
ports:
- mode: ingress
target: 80
published: 80
protocol: tcp
- mode: ingress
target: 443
published: 443
protocol: tcp
- mode: ingress
target: 443
published: 443
protocol: udp
I've found that merging on a service that uses the same port for both tcp and udp only work as expected if the ports array is only defined in the last file.
Expected behavior
I expect the resulting ports array to be the same (untouched) in the examples above.
docker version
Client: Docker Engine - Community
Version: 28.0.0
API version: 1.48
Go version: go1.24.0
Git commit: f9ced58158
Built: Wed Feb 19 22:05:47 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.43.2 (199162)
Engine:
Version: 28.3.2
API version: 1.51 (minimum version 1.24)
Go version: go1.24.5
Git commit: e77ff99
Built: Wed Jul 9 16:13:56 2025
OS/Arch: linux/arm64
Experimental: true
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client: Docker Engine - Community
Version: 28.0.0
Context: desktop-linux
Debug Mode: false
Additional Info
No response
- Lingua principale
- Go
- Stelle
- 6.1k
- Fork
- 2.2k
- Merge medio
- 1g 10h
- PR unite (30g)
- 47
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di docker/cli
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
kind/feature status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
googleapis/librarian#7670 · 2 commenti ·