462 Commits
Author SHA1 Message Date
Agam DuaandGitHub d6de569420 Update default kernel to Kata Containers 3.32.0 debug build (#2143)
- Switch the default guest kernel from vmlinux-6.18.15-186
  (kata-static-3.28.0) to the newer version and variant
  vmlinux-6.18.35-197-debug (kata-static-3.32.0).
- The debug variant enables eBPF, kprobes, uprobes, ftrace
  and BTF (kata-containers/kata-containers#12567).

Signed-off-by: Agam Dua <agam_dua@apple.com>
2026-08-20 15:41:02 -07:00
Noah ThorntonandGitHub 434fda5332 Remove AsyncParsableCommand conformance from ContainerCLI (#2140)
This removes the AsyncParsableCommand protocol from ContainerCLI since
it does not leverage the features that the protocol provides and the
extension main can cause confusion.

Bump to latest containerization version.
2026-08-19 10:28:19 -07:00
Kathryn BaldaufandGitHub 44374a237b Do not set default maskedPaths and readonlyPaths for container machines (#2137)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-08-19 09:44:25 -07:00
b3357fdb2e Split K8sHelper, add WorkerProvisioner protocol, and add LinuxWorker … (#2110)
- Closes #2102.
- LinuxWorkerProvisioner sets up a kind-based node.
- Includes some test cleanups.

Co-authored-by: John Logan <john_logan@apple.com>
2026-08-18 13:12:06 -07:00
Dmitry KovbaandGitHub 7d4ffb6cb1 Fix a compilation error (#2119) 2026-08-13 20:03:09 -07:00
J LoganandGitHub 5fcbeab570 Extracts createPluginLoader() for use by container k8s. (#2115) 2026-08-12 21:00:44 -07:00
Kathryn BaldaufandGitHub ff5aa8a03b Validate volume name in volume disk usage call (#2107)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-08-10 13:42:16 -07:00
J LoganandGitHub 497465635a Remove auto registry scheme. (#2100) 2026-08-10 09:55:53 -07:00
f13b7238d5 Refactor tmpfsMounts() to process tmpfs path correctly (#2103)
Co-authored-by: John Logan <john_logan@apple.com>
2026-08-10 09:49:58 -07:00
Thomas DanielssonandGitHub af405ffd5a Update sudoers file to not include dots (#2080)
- Closes #1713.
- Files under /etc/sudoers.d/ must not contain dots as these
  will be ignored as "backup-files". When writing the sudoers
  file, replace `.` with `_` in the username to form the filename.
2026-08-07 18:36:01 -07:00
J LoganandGitHub 0925ff6298 Refactor container k8s to use plugin resource management. (#2097) 2026-08-07 14:43:56 -07:00
jshi991andGitHub cec124f207 refactor: extract K8s logic into ContainerK8s library target (#2079)
- Closes #2078.
- Move all K8s sources from the container-k8s executable
  into a new ContainerK8s library target. Sources/Plugins/K8s/
  becomes a thin entry point (K8sMain.swift) that calls
  K8sCommand.main().
2026-08-07 10:08:16 -07:00
jshi991andGitHub 0d111be4c6 K8s plugin (#2044)
- closes #2043 
- introduces the k8s plugin, allowing users to make single
  node clusters with the kind base image 
- other functionality is included as well such as creation,
  deletion, and loading custom images
2026-08-05 19:25:27 -07:00
J LoganandGitHub 60612eef51 Integration test: cache warmup image tarfiles. (#2074)
- When pulling warmup images for concurrent tests, save
  the images to a cache directory under the application root.
- Serial tests that aren't testing pull can save time by restoring
  a cached warmup image.
2026-08-05 11:17:20 -07:00
J LoganandGitHub bc50fcb593 Simplify correlation of test prefix to test ID. (#2071) 2026-08-05 09:32:02 -07:00
Aditya RamaniandGitHub ddaf2ca5ac Add --read-only-path and --masked-path option to container run / create (#2069) 2026-08-04 19:04:50 -07:00
J LoganandGitHub cb8cad4562 Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest. (#2066) 2026-08-04 12:17:58 -07:00
Saehej KangandGitHub e87d3a030b [builder]: enable ssh forwarding for container build (#1508) 2026-08-03 08:34:48 -07:00
adityabagchi24andGitHub a58c5fe66c Adjust overcommit and max_map_count vm defaults in guest VMs (#2055)
Each container runs in its own guest VM sized to
`--memory` with no swap, so the guest kernel's
stock `vm` sysctl defaults are hit far too easily:

- `vm.overcommit_memory=0` (heuristic overcommit)
  rejects an oversized `mmap()` upfront whenever the
  reservation exceeds the small, swap-less VM's free
  RAM — even if the memory is never touched —
  returning `ENOMEM`.
- `vm.max_map_count=65530` caps per-process
  mapping count, which mapping-heavy applications
  (e.g. Elasticsearch, many JVMs) can exceed.
2026-08-02 15:33:52 -07:00
Saehej KangandGitHub da8bec6223 [container]: add container export for live containers (#1630)
- When container is not running, the runtime helper
  traverses the container's root fs and writes it to the
  specified tar archive or stdout.
- When the container is running, the helper performs
  the same operation but wraps it in freeze/thaw
  to ensure data integrity for the resulting archive.
2026-08-02 14:55:01 -07:00
48145ac7fb Fix image env vars, build context checks, TCP/UDP port forward buffer, and validate plugin name (#2027)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Raj Aryan Singh <rajaryan_singh@apple.com>
2026-07-28 10:13:10 -07:00
divyanshandGitHub 13e976f88e fix: Increase XPC timeout for Machine API operations (#2006)
- Fixes #2003.
2026-07-27 13:49:18 -07:00
b229cecb53 Allow custom kernel boot args via --kernel-arg (#1744)
Signed-off-by: Ari Rubinstein <22369+arirubinstein@users.noreply.github.com>
Co-authored-by: Ari Rubinstein <22369+arirubinstein@users.noreply.github.com>
2026-07-27 13:44:51 -04:00
J LoganandGitHub d1d763530d Fix BuilderStart race, parallelize container build tests. (#2002)
- Closes #2001.
- Handle "container exists" error gracefully instead
  of failing, when trying to start the buildkit container.
- Move build tests to parallel suites, while the builder
  lifecycle tests remain serial. Parallel builds don't
  use the fixture lock that deletes and restarts the
  builder and runs a build block in isolation.
2026-07-23 15:50:59 -07:00
adityabagchi24andGitHub 78e2cb4417 Use log instead of print for system start status messages (#1889) 2026-07-22 21:40:43 -07:00
J LoganandGitHub 9af6e0e5e5 Integration test - miscellaneous fixture and test refinements. (#1993) 2026-07-22 17:19:14 -07:00
J LoganandGitHub 72431b0458 Add OCI maskedPaths and readonlyPaths support to Container API. (#1996) 2026-07-22 16:28:26 -07:00
J LoganandGitHub f0b2b96a26 Use enum for warmup images. (#1990)
- Closes #1982.
- Makes warmup image code more readable in tests.
2026-07-22 09:45:33 -07:00
Kathryn BaldaufandGitHub a51d54b553 Container test fixture package (#1887)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-07-21 18:15:47 -07:00
J LoganandGitHub b130babb15 Use ordered journal mode for unpacked images. (#1974) 2026-07-21 17:12:01 -07:00
J LoganandGitHub a6813ed66f Periodic dependency updates. (#1981) 2026-07-21 16:42:33 -07:00
Kathryn BaldaufandGitHub 06127de1cd Update containerization dependency with new EXT4Unpacker func definition (#1973)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-07-21 13:52:31 -07:00
Kathryn BaldaufandGitHub 3310f342e8 Do not follow destination symlink when copying user configuration (#1957)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-07-20 15:46:42 -07:00
Kathryn BaldaufandGitHub 3f543ba12f Remove force unwraps on XPC error set/get (#1958)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-07-20 15:14:05 -07:00
Kathryn BaldaufandGitHub 9e1d6e8b6e Validate container ID from XPC requests (#1956)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-07-20 10:42:37 -07:00
0x4C33andGitHub 57b07fa2ac Verify kernel archive integrity (#1703)
Closes https://github.com/apple/container/issues/1687

The default kernel archive is downloaded from a remote release URL
during first-run setup and via `container system kernel set
--recommended`. Previously, the archive contents were not verified after
download, so integrity depended on HTTPS and the release artifact
remaining unchanged.

This change adds digest verification for kernel archives. The
recommended/default kernel now has pinned digest metadata using an
algorithm-prefixed value such as `sha256:<hex>`. `container system
kernel set --tar` accepts `--digest`; remote tar URLs require it, and
local tar archives can also be verified before unpacking and
installation.

The system config also supports `kernel.digest`, and a custom
`kernel.url` must provide a digest for that archive.
2026-07-13 13:04:39 -07:00
adityabagchi24andGitHub 36dc063902 Upgrade grpc-swift-nio-transport to 2.9.0 and remove HTTP2ConnectBuff… (#1790)
- Fixes #1789.
- Release 2.9.0 of `grpc-swift-nio-transport` fixes
  an HTTP/2 initialization race where the server could
  send SETTINGS before gRPC handlers are added to
  the pipeline, causing the client to hang. The new
  `WrappedChannel.wrapping(config:serviceConfig:makeChannel:)`
  API calls `configure(channel)` inside the channel
  initializer, ensuring the pipeline is set up before any inbound
  bytes arrive. This eliminates the need for the custom
  `HTTP2ConnectBufferingHandler` workaround.
2026-07-07 10:23:50 -07:00
Noah ThorntonandGitHub edd6dee2db Integration coverage xpc helpers (#1551)
- This fixes the LLVM coverage data not properly being emitted for XPC
  services. It requires piping the `LLVM_PROFILE_FILE` environment
  variable through to all the services and plugins. The variable itself
  also required the "%c" formatter to ensure that it continuously emits
  coverage data, otherwise when XPC services are killed via "bootout" they
  do not emit coverage.
2026-07-06 15:43:30 -07:00
aa7fef3d1d Route container image save reference list to stderr in stdout mode (#1804)
- Fixes #1801.
- When `container image save` runs without `--output`,
  stdout carries the OCI tar archive. The command writes 
  the archive bytes to stdout and then `print(reference)`s
  each saved image reference to stdout afterward,
  appending non-archive text after the tar EOF marker,
  which will cause strict tar/OCI consumers to fail.
- This routes the saved-reference list to stderr in the
  no-`--output` branch, so stdout contains only archive
  bytes. When saving to a file via `--output`, stdout is
  free, so the references continue to print to stdout
  exactly as before.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 10:04:30 -07:00
SEPURI-SAI-KRISHNAandGitHub 0b6c79f3d3 fix: propagate error from createDirectory in system start (#1785)
- `SystemStart` used `try!` when creating the apiserver
  data directory. File system operations can fail for
  legitimate reasons: insufficient permissions, disk full,
  read-only volume. Crashing the process in these cases
  gives the user no actionable error message.
- Replaced with `try` so the error propagates up and is
  surfaced cleanly.
2026-06-25 21:38:40 -07:00
Hugo, CY LAUandGitHub 0c95007763 perf(parser): add collection capacity hints to known-size loops (#1791)
- For result sets with known sizes, it's more efficient
  to supply the size as a capacity hint.
2026-06-25 19:42:37 -07:00
J LoganandGitHub 4a6084cc95 Remove network variant computation from API server. (#1814)
- Closes #1812.
- The network plugin is the source of truth for the variant, if any,
that applies to the network. Resolving a missing variant configuration
option in the API server can create a situation where the variant the
runtime uses for interface selection is incorrect.
- Adds serial suites trait to tests to see whether it helps current CI
issues.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Fixes a flaw in our interface strategy logic.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-06-25 14:06:45 -07:00
SEPURI-SAI-KRISHNAandGitHub 137b3bdaf0 Fix/exec empty arguments crash (#1783)
- `swift-argument-parser` enforces that `arguments` is
  non-empty before `run()` is invoked, so the force-unwrap
  of `arguments.first!` is not reachable in practice. However,
  the guard makes the invariant explicit in the code itself,
  removes reliance on ArgumentParser's implicit
  enforcement, and would satisfy force-unwrap lint rules
  if enabled in the future.
2026-06-25 12:40:39 -07:00
Bhavesh VarmaandGitHub 1d70dd6ab9 Log the graceful-stop error instead of silently discarding it in gracefulStopContainer (#1782)
- Closes #1756.
- `RuntimeService.gracefulStopContainer(_:signal:timeout:)`
  wraps the graceful-stop attempt in `do { … } catch {}`. The
  empty catch silently discards any thrown error before falling
  through to the unconditional `lc.stop()`. It is the only catch
  in this file that does not log; every other one uses
  `self.log.error(…, metadata: ["error": "\(error)"])`.
- This adds a single log line matching that convention, so
  a failed graceful stop (and the resulting fall-through to a
  forced VM shutdown) is more diagnosable. The intentional
  fall-through to `lc.stop()` is unchanged.
2026-06-23 10:46:00 -07:00
SEPURI-SAI-KRISHNAandGitHub 5e125d8e2a fix: remove force-unwrap on session dictionary in DefaultNetworkService (#1787)
- Instead of using force-unwrap to append to a list-valued
  dictionary entry that should always exist, assign the value
  with a default fallback and append to the (non-optional)
  result.
2026-06-23 09:52:05 -07:00
SEPURI-SAI-KRISHNAandGitHub 0e3651b4f1 fix: replace try! with try? for stdout/stderr writes in ProcessIO (#1784)
- In `ProcessIO.swift`, the readability handlers for stdout and stderr
  used `try!` when writing data to the output file handles. This would
  cause crashes If the pipe is broken such that the force-try executes.
- Changed to handle a failed write similarly to an EOF.
2026-06-23 09:38:43 -07:00
09489cba45 fix(cp): resolve relative host paths against current directory (#1741)
Fixes #1738

`container cp` fails when the host source path is relative (e.g.
`container cp file foo:/root/`), because `NSString.standardizingPath`
only canonicalizes paths but does not make them absolute. The unchanged
relative path is then interpreted as `/file` (root-absolute) by
`URL(fileURLWithPath:)` on the runtime side.

Fixed by resolving relative paths against the current working directory
before use, matching the pattern already used by `container export`,
`container image save`, and `container image load`.

The same fix was also applied to the copy-out destination path (line
68), which had the same issue.

## Type of Change

- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context

`container cp file foo:/root/` fails with `"copyIn: source not found
'/file'"` because the relative path `file` is never expanded to an
absolute path. Using `$PWD/file` works, but relative paths should work
too — every other command in the codebase handles this correctly.

## Testing

- [x] Tested locally — builds and all existing tests pass
- [ ] Added/updated tests
- [ ] Added/updated docs

---------

Co-authored-by: jwhur <57657645+JaewonHur@users.noreply.github.com>
2026-06-22 11:54:00 -07:00
J LoganandGitHub 888582b4c8 Propagate permissions for all host-to-container socket mounts. (#1751)
- Closes #1750.
- Applies permission code used for the `--ssh` mount to all
host-to-container socket mounts.
- Adds a user option to the `doExec` test support function.
- Updates the `testRunCommandUnixSocketMount` to install `nc` in the
test container, and check the socket permission, and check the mounted
socket using `nc` as the guest user.
2026-06-18 11:45:24 -07:00
Michael CrosbyandGitHub c4a22389ac add container machine nested virt (#1742)
This also includes custom kernels for container machine. Its required
with nested virt as CONFIG_KVM needs to be enabled.

---------

Signed-off-by: michael_crosby <michael_crosby@apple.com>
2026-06-18 06:53:21 -07:00
Charlie LeandGitHub b34cf390a6 Fix duplicate "(default: 3)" in --max-concurrent-downloads help text (#1725)
Remove manually specified default value from help string since
ArgumentParser already appends it automatically from the property's
default value.

Signed-off-by: Charlie Le <charlie_le@apple.com>
2026-06-16 14:13:59 -07:00