Skip to content

Add expose_ports config option to publish extra container ports - #433

Draft
skyrpex wants to merge 3 commits into
mainfrom
claude/expose-ports-config-a03bc2
Draft

Add expose_ports config option to publish extra container ports#433
skyrpex wants to merge 3 commits into
mainfrom
claude/expose-ports-config-a03bc2

Conversation

@skyrpex

@skyrpex skyrpex commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

DEVX-994 asks for a way to expose extra container ports (e.g. port 53 for the emulator's DNS server, --host-dns in v1) beyond what lstk publishes by default. Per the ticket's own suggested approach, this adds a generic expose_ports config option rather than a DNS-specific flag.

Changes

  • New expose_ports config option to publish additional ports on the emulator container.
  • Validation for the new option, with clear errors on conflicting or malformed entries.
  • Existing default port publishing is unaffected.
  • Docs updated to cover the new option.

For docs

New config knob, no CLI flag. Add a section under the config.toml reference (near volumes/container_name):

  • What it's for: publish container ports lstk doesn't expose by default — e.g. the emulator's DNS server on port 53 (replaces v1's --host-dns).
  • Where: expose_ports inside a [[containers]] block.
  • Syntax: a list of port numbers and/or Docker-style strings.
    [[containers]]
    type = "aws"
    port = "4566"
    expose_ports = [53, "5354:5353/udp"]
    • 53 → publishes port 53 on the host for both TCP and UDP (a bare number covers both, since DNS needs both).
    • "5354:5353/udp"host:container/protocol — host port 5354 maps to container port 5353, UDP only.
    • "53/tcp" → protocol-only entry, host port defaults to the same number.
  • Failure mode worth calling out: if the host port is already taken, lstk start fails outright (unlike some other lstk ports, this one won't silently skip and continue).
  • Not covered: you cannot use expose_ports to change ports lstk already manages (4566, 443, the 4510-4559 range) — those are fixed regardless of what you put here.

Review

Human review advised — new user-facing config surface, and the bare-port-expands-to-tcp+udp behavior is a judgment call worth a second look.

Tests

  • Unit tests: config grammar (mixed int/string TOML, all entry forms, dedup, invalid entries) and merge/skip/warn/UDP-preflight/bind-hint behavior in internal/container.
  • Integration tests added in test/integration/start_test.go: default-ports-unchanged, expose+remap+protocol edge cases, port-already-taken, and config validation.
  • make test, make lint pass.

Closes DEVX-994

Co-Authored-By: Claude <noreply@anthropic.com>
@skyrpex skyrpex added semver: minor docs: needed Pull request requires documentation updates labels Aug 5, 2026
skyrpex and others added 2 commits August 5, 2026 10:16
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant