Skip to content

fix(publish): accept short-form port mappings (fixes #13672)#13849

Open
Ijtihed wants to merge 1 commit into
docker:mainfrom
Ijtihed:fix-publish-short-form-ports-13672
Open

fix(publish): accept short-form port mappings (fixes #13672)#13849
Ijtihed wants to merge 1 commit into
docker:mainfrom
Ijtihed:fix-publish-short-form-ports-13672

Conversation

@Ijtihed

@Ijtihed Ijtihed commented Jun 17, 2026

Copy link
Copy Markdown

What I did

docker compose publish failed with 'services[whoami].ports[0]' expected a map or struct, got "string" when a service used short-form port syntax like ${DASHBOARD_PORT:-3000}:3000.

composeFileAsByteReader used LoadWithContext which decodes ports into typed Go structs which rejects short-form string entries. Switching to LoadModelWithContext returns a raw map instead which in ths case avoids the struct decode

Related issue

Fixes #13672

@Ijtihed Ijtihed requested a review from a team as a code owner June 17, 2026 16:51
@Ijtihed Ijtihed requested review from glours and ndeloof June 17, 2026 16:51
@Mohataseem89

Copy link
Copy Markdown

i have one question regarding coverage:
does this approach also handle other valid short-form port declarations beyond the reproducer, for example:

ports:
  - "8080:80"
  - "127.0.0.1:8080:80"
  - "${PORT:-8080}:80"

It may be worth adding or extending tests to cover a few representative short-form variants to ensure the publish path remains aligned with Compose port syntax support

Signed-off-by: Ijtihed Kilani <ijtihedk@gmail.com>
@Ijtihed Ijtihed force-pushed the fix-publish-short-form-ports-13672 branch from c8cdd16 to 523c51c Compare June 17, 2026 17:45
@Ijtihed

Ijtihed commented Jun 17, 2026

Copy link
Copy Markdown
Author

i have one question regarding coverage: does this approach also handle other valid short-form port declarations beyond the reproducer, for example:

ports:
  - "8080:80"
  - "127.0.0.1:8080:80"
  - "${PORT:-8080}:80"

It may be worth adding or extending tests to cover a few representative short-form variants to ensure the publish path remains aligned with Compose port syntax support

Agree.

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.

[BUG] docker compose publish rejects short-form port mapping

2 participants