From 3b5b491052f4da09e24754f9085a11cd9692f73a Mon Sep 17 00:00:00 2001 From: w1zdun <19057733+w1zdun@users.noreply.github.com> Date: Sun, 7 Jun 2026 13:27:37 +0200 Subject: [PATCH] fix(run): do not pass unsupported --hostname to container run The container CLI has no --hostname flag, so any service declaring 'hostname:' made the whole run command fail with "Unknown option '--hostname'". The field is now ignored with an explanatory note, matching how the unsupported restart policy is handled. --- Sources/Container-Compose/Commands/ComposeUp.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/Container-Compose/Commands/ComposeUp.swift b/Sources/Container-Compose/Commands/ComposeUp.swift index 3a874f08..7c8d7407 100644 --- a/Sources/Container-Compose/Commands/ComposeUp.swift +++ b/Sources/Container-Compose/Commands/ComposeUp.swift @@ -533,11 +533,12 @@ public struct ComposeUp: AsyncParsableCommand, @unchecked Sendable { print("Note: Service '\(serviceName)' is not explicitly connected to any networks. It will likely use the default bridge network.") } - // Add hostname + // The 'hostname' field is not supported by `container run` (no --hostname + // flag); passing it would make the whole run command fail to parse. if let hostname = service.hostname { - let resolvedHostname = resolveVariable(hostname, with: environmentVariables) - runCommandArgs.append("--hostname") - runCommandArgs.append(resolvedHostname) + print( + "Note: Service '\(serviceName)' sets 'hostname: \(hostname)', but the 'container' tool does not support setting a hostname. The field is ignored." + ) } // Add working directory