fix(docker/container): report assigned host ports, support extra hosts, stop disconnecting foreign networks - #1398
Merged
Conversation
…s, stop disconnecting foreign networks Three independent `Docker.Container` bugs. `external: 0` means "any free host port", but the create arg asked Docker for host port 0 literally, and `toContainerAttributes` then overlaid the *requested* `HostConfig.PortBindings` on top of the *assigned* `NetworkSettings.Ports`, so the attribute read back as 0. Random publishes now use Docker's bare `internal/protocol` form, and the assignment wins over the request (the request stays the fallback for a created-but-not-started container). Fixes #1388. `extraHosts` had no way in: no prop, no `--add-host` create arg, so a container could not be given a `host-gateway` mapping. Fixes #1387. Reconciliation derived network removals from every live network, so any network alchemy had not connected — Docker's default `bridge`, or one attached by a user, a compose file, or another tool — was torn off. Removals now come from `olds.networks`, the only record of what alchemy itself attached. Fixes #1386. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: Alchemyalchemy bun add https://pkg.ing/alchemy/e2ee40e@alchemy.run/better-auth bun add https://pkg.ing/@alchemy.run/better-auth/e2ee40e@alchemy.run/cloudflare-runtime bun add https://pkg.ing/@alchemy.run/cloudflare-runtime/e2ee40e@alchemy.run/frontend-frameworks bun add https://pkg.ing/@alchemy.run/frontend-frameworks/e2ee40e@alchemy.run/node-utils bun add https://pkg.ing/@alchemy.run/node-utils/e2ee40e@alchemy.run/pr-package bun add https://pkg.ing/@alchemy.run/pr-package/e2ee40e@alchemy.run/floci bun add https://pkg.ing/@alchemy.run/floci/e2ee40eDistilled@distilled.cloud/core bun add https://pkg.ing/@distilled.cloud/core/db3a1b5@distilled.cloud/aws bun add https://pkg.ing/@distilled.cloud/aws/db3a1b5@distilled.cloud/axiom bun add https://pkg.ing/@distilled.cloud/axiom/db3a1b5@distilled.cloud/cloudflare bun add https://pkg.ing/@distilled.cloud/cloudflare/db3a1b5@distilled.cloud/hetzner bun add https://pkg.ing/@distilled.cloud/hetzner/db3a1b5@distilled.cloud/neon bun add https://pkg.ing/@distilled.cloud/neon/db3a1b5@distilled.cloud/planetscale bun add https://pkg.ing/@distilled.cloud/planetscale/db3a1b5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent
Docker.Containerbugs, each with a regression test that fails without its fix.Assigned host port reported as 0 (#1388)
external: 0means "any free host port". The create arg asked for host port 0 literally, andtoContainerAttributesthen overlaid the requested bindings on top of the assigned ones:The request stays the fallback — a created-but-not-started container has empty
NetworkSettings.Ports.Before:
expected 0 to be greater than 0.No way to set extra hosts (#1387)
Added
extraHosts?: string[], forwarded as--add-host:Before:
expected null to equal ArrayContaining [ "host.docker.internal:host-gateway" ].Reconciliation disconnected foreign networks (#1386)
Removals were derived from every live network, so anything alchemy had not connected was torn off — including Docker's default
bridge. They now come fromolds.networks, the only record of what alchemy itself attached; the live container cannot say who connected a network.Before, after dropping one managed network, the container was left with no networks at all:
expected [ ] to contain "alchemy-test-foreign-network".