From fc928cbaed952bbe9d1f64609ab9b094507f02c3 Mon Sep 17 00:00:00 2001 From: Kathryn Baldauf Date: Wed, 3 Jun 2026 11:30:08 -0700 Subject: [PATCH] Add an error message for dockerfile >= 16KB until #735 is resolved Signed-off-by: Kathryn Baldauf --- Sources/ContainerCommands/BuildCommand.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/ContainerCommands/BuildCommand.swift b/Sources/ContainerCommands/BuildCommand.swift index f15aa60cc..2878f32f4 100644 --- a/Sources/ContainerCommands/BuildCommand.swift +++ b/Sources/ContainerCommands/BuildCommand.swift @@ -251,6 +251,20 @@ extension Application { ignoreFileData = try? Data(contentsOf: ignoreFileURL) } + // BUG: See https://github.com/apple/container/issues/735. + // Reject dockerfiles larger than 16kb before attempting to build. + // TODO: Remove when #735 was been resolved. + let maxDockerfileSize = 16 * 1024 // 16 KiB + guard buildFileData.count < maxDockerfileSize else { + throw ContainerizationError( + .invalidArgument, + message: """ + Dockerfile size (\(buildFileData.count) bytes) exceeds the maximum allowed size of \(maxDockerfileSize) bytes. \ + See https://github.com/apple/container/issues/735. + """ + ) + } + let secretsData: [String: Data] = try self.secrets.mapValues { secret in switch secret { case .data(let data):