Skip to content

Add explicit host entries to container configuration#1

Closed
mazdak wants to merge 1 commit into
mainfrom
pr2/container-host-entries
Closed

Add explicit host entries to container configuration#1
mazdak wants to merge 1 commit into
mainfrom
pr2/container-host-entries

Conversation

@mazdak
Copy link
Copy Markdown
Owner

@mazdak mazdak commented Mar 22, 2026

Problem

While building a Docker Compose-like plugin for container and validating it against our real Docker Compose workload, we hit a core limitation: there was no way for callers to ask the runtime to append explicit entries to a container's /etc/hosts.

That showed up most clearly with Compose extra_hosts, especially the common host.docker.internal pattern. The plugin could parse those mappings, but there was no core field to carry them into the sandbox, so the runtime always generated only the default localhost/container-name entries.

In practice, containers that depended on host aliases still failed name resolution even though the compose file specified them.

Why this belongs in core

This is not something the plugin can fake safely. /etc/hosts is generated in the sandbox layer, so callers need a first-class way to provide additional host entries to the runtime.

What this changes

  • add ContainerConfiguration.HostEntry
  • add ContainerConfiguration.hosts
  • preserve those entries through configuration encoding/decoding
  • extend sandbox host generation to append caller-provided host entries after the default localhost and primary hostname entries
  • add focused tests for round-tripping and host resolution behavior

Validation

  • swift test --filter ContainerConfigurationTest
  • swift test --filter SandboxServiceHostsTest

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21c0cb3a0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mazdak mazdak marked this pull request as draft March 22, 2026 19:56
@mazdak mazdak marked this pull request as ready for review March 22, 2026 20:34
@mazdak mazdak closed this Mar 24, 2026
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.

1 participant