fix(daemon): relay a loopback State Store with external NATS, and only for the task's container

This commit is contained in:
sam committed 2026-10-22 17:35:24 +11:00
1 parent b395eec893
commit 2ca7c9b2b9
5 files changed
+136 -43

No files matched your search

+5 -4
View File
@@ -427,10 +427,11 @@ func startContainers(
RegistryAuth: resolveRegistryAuth(cfg.Containers.RegistryAuth, secrets, log),
Network: cfg.Containers.Network,
DockerClient: dockerCli,
// Only the embedded broker binds a discovered host gateway. The
// standalone State Store uses its configured, container-reachable target.
RequireHostGateway: cfg.NATS.Mode == config.NATSModeEmbedded,
Instance: cfg.Instance,
// The embedded broker binds the host gateway, and a loopback State
// Store is relayed from it: containers reach neither otherwise.
RequireHostGateway: cfg.NATS.Mode == config.NATSModeEmbedded ||
daemon.StateStoreNeedsRelay(cfg.Services.Get(config.ServiceNameState).Target),
Instance: cfg.Instance,
}, containerLiveSettings(cfgHolder), log)
if err != nil {
// A missing image is recoverable by hand.