Commit Graph

355 Commits

Author SHA1 Message Date
Kathryn Baldauf d6f052d206 Update license header on all files to include the current year (#1024)
## Motivation and Context
Now that we're in 2026, we need to update the license headers on all the
files. Unfortunately, Hawkeye doesn't have an attribute for the current
year to help us avoid this in the future. Instead, I had to work around
this by doing the following:

1. Update licenserc.toml with:
     ```
      [properties]
       ... (other properties)
       currentYear = "2026"
     ```
 
2. Update scripts/license-header.txt with
    ```
Copyright ©{{ " " }}{%- set created = attrs.git_file_created_year or
attrs.disk_file_created_year -%}{%- set modified = props["currentYear"]
-%}{%- if created != modified -%} {{created}}-{{modified}}{%- else
-%}{{created}}{%- endif -%}{{ " " }}{{ props["copyrightOwner"] }}.
    ```

Then I removed these two changes before committing. After this PR is
merged, all files will have recently had git updates, so the existing
code for setting the modified year should work as intended.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-01-05 13:09:34 -08:00
Danny Canter 20dc0bcfee Parser: Support relative paths for --volume (#1013) 2026-01-04 11:11:09 -08:00
Danny Canter 028e7e109f Deps: Bump Containerization to 0.19.0 (#1015)
Has read-only rootfs support.
2026-01-04 10:52:46 -08:00
Danny Canter 020949ea2b CLI: Small fixups for implicit envvars (#1014)
We should only inherit from the host if there's no =. Additionally
document the flag a little more to show that we can inherit from the
host.
2026-01-04 10:51:20 -08:00
Amir Alperin df368b790e Fix port validation to allow same port for different protocols (#992) (#1000)
- Fixes: #992 
- Port validation previously rejected valid configurations
  when the same port number was used for different
  protocols (TCP and UDP). For example:
 `-p 1024:1024/udp -p 1024:1024/tcp`
  Although this is a valid and common use case, the
  validation logic treated it as a conflict.

To fix this, I updated the validation key to include the protocol name.
The validation now checks for overlapping port numbers only within the
same protocol, rather than across all protocols.

This change enables binding the same port number for both TCP and UDP,
aligning the validation behavior with real-world networking
requirements.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2026-01-04 10:49:22 -08:00
J Logan cf64614173 Update OSS header in Package.swift. (#1010) 2026-01-02 14:10:48 -08:00
J Logan 375ce16a99 Fix OSS header dates that break CI checks. (#1009) 2026-01-02 12:09:12 -08:00
c 580d8531c0 Use full path for uninstall script in upgrade instructions (#983)
- Makes the upgrade section consistent with the
  uninstall section by using the full path to the
  uninstall script.
2026-01-01 21:19:57 -08:00
c 4cadc401e1 Clarify uninstall script location in README (#982)
- Clarifies where the `uninstall-container.sh` script is located after
installation
- Updates example commands to use the full path
2026-01-01 19:53:56 -08:00
c 4e78e30b20 Fix grammar in tutorial.md (#985)
## Summary
- Fixes a grammar error in the tutorial's publish section

## Details
Line 287 of `docs/tutorial.md` had "you need push images" which should
be "you need to push images".

This is a simple grammar fix to improve readability.

## Test plan
- [x] Verified the sentence now reads correctly
2026-01-01 17:57:47 -08:00
Danny Canter 22dfd6e7c7 CLI: Fix stop not signalling waiters (#972) 2026-01-01 17:57:00 -08:00
c 4958cf272f Fix bash completion source path in documentation (#981)
- Corrects the source path for bash completion script
  when not using bash-completion package.
2026-01-01 17:51:10 -08:00
c 25ac79a0c4 Fix MAC address option typo in how-to documentation (#980)
- Corrects the MAC address example command in the
  how-to guide to use the correct `--network` flag syntax
  instead of the incorrect `--mac-address` flag.
2026-01-01 17:50:19 -08:00
Raj edadf155cd Fix container auto-delete on rapid stop/start (#841)
Fixes #833.

Currently, when stopping and immediately restarting a container, it would fail with the error:
`“container expected to be in created state, got: shuttingDown”` and then be automatically deleted.
The `SandboxService` process waits five seconds before exiting after shutdown. During this interval, a rapid restart could reconnect to the still-terminating process in the `shuttingDown` state, triggering a state validation error.

This fix forcefully terminates the `SandboxService` process with `SIGKILL` upon container exit, instead of waiting five seconds. The bootstrap now defensively checks for and cleans up any stale services before registering new ones, preventing reconnections to processes in the `shuttingDown` state.
2026-01-01 01:40:39 -08:00
J Logan 5064b0ffd5 Adds network IPv6 configuration. (#975)
- Part of work for #460.
- Enable set/get of IPv6 network prefix in ReservedVmnetNetwork.
- Show IPv6 prefix in `network list` full output.
- Option for setting IPv6 prefix when creating a network.
- System property for default IPv6 prefix.

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

## Motivation and Context
See #460.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-12-22 10:16:14 -08:00
Volodymyr Bortniak 9c239aa36c Add support for reading env from named pipes (#974)
This is a fix for
[issue#956](https://github.com/apple/container/issues/956)

`FileManager.default.contents(atPath:)` returns `nil` for named pipes
(FIFOs)
and process substitutions like `/dev/fd/XX` because:
1. It expects regular files with a known size
2. Named pipes are stream-based and block until data arrives

## Solution
Use `FileHandle(forReadingFrom:)` instead, which:
- Properly handles blocking I/O
- Works with named pipes, process substitutions, and regular files
(mentioned in the
[doc](https://developer.apple.com/documentation/foundation/filehandle))

Co-authored-by: Bortniak Volodymyr <Bortnyak@users.noreply.github.com>
2025-12-19 15:36:02 -08:00
Danny Canter 3c3a83c98a Turn on oops=panic kernel cmdline (#971) 2025-12-18 16:28:44 -08:00
Michael Gathara b1b99809d4 Fix: Kubes Cluster in Container Crashing Container (IS#923) (#930)
- Fixes issue #923 
- I fixed a race condition in `ConnectHandler.swift` where
  an asynchronous network connection could complete
  after the handler had already been removed from the
  pipeline.
- This prevents the EXC_BREAKPOINT crash in
  container-runtime-linux that occurred when kinc
  (Kubernetes in Container) created rapid connections.
- The actual fix was inadvertently applied in #957, so this
  PR contains only the test code.
2025-12-17 18:58:50 -08:00
Saehej Kang 9f4efe0c4c [networks]: add prune command (#914)
- Closes #893
2025-12-17 00:30:33 -08:00
J Logan 4f88725158 Use new IP/CIDR types from Containerization. (#957)
- Part of work for #460.
- With CZ release 0.17.0, the IP and CIDR address
  types changed from String to IPv4Address and
  CIDRv4, respectively. This PR applies the corresponding
  adaptations to container.
2025-12-16 16:34:13 -08:00
Salman Chishti 8e16bb239e Upgrade GitHub Actions to latest versions (#959)
- Upgrade GitHub Actions to their latest versions for
  improved features, bug fixes, and security updates.

Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2025-12-16 12:14:45 -08:00
Salman Chishti 0c7dca4d25 Add Dependabot for GitHub Actions updates (#960)
## Summary

Add Dependabot configuration to automatically keep GitHub Actions up to
date.

## Changes

Adds `.github/dependabot.yml` configured to:
- Check for GitHub Actions updates weekly
- Group all action updates together for easier review
- Use `ci` prefix for commit messages

## Why

As discussed in #958, this helps:
- Keep actions up to date with security patches automatically
- Handle Node runtime deprecations proactively (e.g., Node 20 → Node 24)
- Reduce manual maintenance burden

## Reference

Based on the pattern used in
[swift-nio](https://github.com/apple/swift-nio/blob/main/.github/dependabot.yml).
2025-12-16 11:23:31 -08:00
Salman Chishti 637c8f11a9 Upgrade GitHub Actions for Node 24 compatibility (#958)
## Summary

Upgrade GitHub Actions to their latest versions to ensure compatibility
with Node 24, as Node 20 will reach end-of-life in April 2026.

## Changes

| Action | Old Version(s) | New Version | SHA |
|--------|---------------|-------------|-----|
| `actions/checkout` | v4 | v6 | `8e8c483` |
| `actions/download-artifact` | v4 | v7 | `37930b1` |
| `actions/upload-artifact` | v4 | v6 | `b7c566a` |
| `actions/labeler` | v5 | v6 | `634933e` |
| `actions/configure-pages` | v5 | v5 | `983d773` |
| `actions/upload-pages-artifact` | v3 | v3 | `56afc60` |
| `softprops/action-gh-release` | v2 | v2 | `a06a81a` |

## Context

Per [GitHub's
announcement](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/),
Node 20 is being deprecated and runners will begin using Node 24 by
default starting March 4th, 2026.

### Why this matters

- **Node 20 EOL**: April 2026
- **Node 24 default**: March 4th, 2026
- **Action**: Update to latest action versions that support Node 24

### Security

All actions are now **pinned to commit SHAs** instead of mutable version
tags. This provides:
- Protection against tag hijacking attacks
- Immutable, reproducible builds
- Version comments for readability

### Automated Updates

A follow-up PR (#960) adds Dependabot configuration to automatically
keep these actions updated with new SHA-pinned versions.

### Testing

These changes only affect CI/CD workflow configurations and should not
impact application functionality. The workflows should be tested by
running them on a branch before merging.

Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2025-12-16 10:15:42 -08:00
karen heckel c22f1289fc Feat: customize console output with env variable (#952)
Fixes apple#915

Added a new feature to support the passing of buildkit colors for
customizing console output.
2025-12-15 21:16:55 -08:00
Saehej Kang 9b7cfd852e [images]: refactor prune command (#941)
- Updates to `image prune` for consistency with how
  other `prune` commands are done. Added missing
  test cases as well for the command
- Relates to the discussion from #914
2025-12-15 17:52:00 -08:00
Danny Canter 7d30720028 CLI: Fix -it not being able to pipe stdout (#951)
Fixes #949

Typically if one fd is a tty, it's common for all 3 of stdio to be the
same, but that is not always the case. In our case we were using our
Terminal type from Containerization to comb through err/out/in and give
us a type backed by one of the 3 if -t was supplied. It happens that
stderr is the first we check, so our Terminal() is backed by fd 2. This
change modifies things so that we always initialize our Terminal if
asked for with fd 0, and out/err are backed by their corresponding
correct fd number.

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

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2025-12-11 05:36:15 -08:00
wangxiaolei a2901e0517 feat: implement version sub command (#911)
- closes #383
- implement version sub command, give more info

---------

Co-authored-by: fatelei <fatelei@fateleis-MacBook-Pro.local>
2025-12-09 23:04:40 -03:00
Danny Canter 0cde1efe30 Deps: Bump Containerization to 0.16.2 (#947)
Closes https://github.com/apple/container/issues/928

Has a cgroup fix when stopping certain containers
2025-12-09 13:24:45 -08:00
Dmitry Kovba 38960553cb Lowercase error messages (#945)
## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
For consistency, all error messages are lowercased.

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs

---------

Co-authored-by: J Logan <sgtbakerrahulnet@yahoo.com>
2025-12-09 12:32:28 -08:00
Saehej Kang 0733a81a6d [volumes]: refactor prune command (#940)
- Refactor the `volume prune` command to follow a client-side approach.
  The `volumeDiskUsage` is calculated in the service file, so it made
  sense to leave that there.
- Relates to the discussion from #914
2025-12-09 15:54:37 -03:00
Kathryn Baldauf 42528e6c43 Update CONTRIBUTORS to MAINTAINERS and point at containerization (#942)
## Type of Change
- [x] Documentation update

## Motivation and Context
See https://github.com/apple/containerization/pull/435 for more
information on this change.
2025-12-09 10:42:27 -08:00
J Logan a64bd77b15 Fix broken image integration tests. (#944)
- Fixes #943.
- Use images other than alpine:3.20 for image concurrency test so as not
to interfere with tests using that image.
- Rename test files to match suite names.
2025-12-09 14:35:34 -03:00
TTtie ab92f3938e fix(TerminalProgress): make the progress bar respect locale-specific decimal separator (#936)
- The `ProgressBar#adjustFormattedSize` function currently expects a
  decimal dot when adding the additional ".0" to the size. This, however,
  breaks when a region with a non-dot decimal separator is used.
2025-12-08 14:17:10 -03:00
J Logan 420be748f1 Data integrity: bump to cz 0.16.1, adjust sync mode. (#939)
- 0.16.1 changes an ext4 superblock setting that might have been causing
problems.
- #877 fixed an issue where the cache and sync settings for block
filesystems weren't being passed down to the VZ virtual machine
configuration. The default sync value getting passed down is `full`,
which reduces I/O performance. Relax this to use `fsync` for now.

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

## Motivation and Context
May address problems reported in #877.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
0.7.1
2025-12-07 22:00:02 -08:00
Santosh Bhavani f7bcb687fd Add --max-concurrent-downloads flag for parallel layer downloads (#716)
Adds `--max-concurrent-downloads` flag to `container image pull` for
configurable concurrent layer downloads.

Fixes #715
Depends on apple/containerization#311

**Usage**:
```bash
container image pull nginx:latest --max-concurrent-downloads 6
```

**Changes**:
- Add CLI flag (default: 3)
- Thread parameter through XPC stack
- Update to use forked containerization with configurable concurrency

**Performance**: ~1.2-1.3x faster pulls for multi-layer images with
higher concurrency

**Tests**: Included standalone tests verify concurrency behavior and
parameter flow

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-07 15:56:50 -03:00
J Logan 1e19a4d6e3 Updates CZ to 0.16.0. (#927) 0.7.0 2025-12-02 20:48:37 -03:00
J Logan 856d594938 Fix incorrect creationDate for networks. (#926)
- Fixes #925.
- When the API service enumerates creation dates, the configuration
value from the network helper is used instead of the persistent config
value, so the creation date winds up being the current time. The short
term fix is for the API server to return NetworkState values that
combine the API server's persistent network config with the network
status returned from the helper.
- The longer term refinement could be to define a uniform model for
resources where each resource type has Metadata (id/Identifiable,
creationDate, labels), and type-specific configuration and state/status.

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

## Motivation and Context

See above.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2025-12-02 18:57:57 -03:00
Saehej Kang 6f55360def [networks]: Add creationDate field (#791)
- Closes #665 
- Existing containers that don't have `creationDate` default
  to the epoch date.
2025-12-02 10:15:26 -03:00
Saehej Kang a5fd902893 [docs]: move callout regarding documentation revisions (#921)
- Closes #920
- Makes note about main branch documentation more discoverable.
2025-12-02 10:12:42 -03:00
Ronit Sabhaya f394d87b26 fix: connect to backend immediately on channel active for server-first protocols(#794) (#813)
- Closes #794 
- TCP port forwarding currently fails for server-first protocols (SMTP,
  FTP, SSH, PostgreSQL) because the backend connection is only established
  when the client sends data.
2025-12-01 19:52:57 -03:00
Saehej Kang f0eb13176c [docs]: add volume prune to command reference (#910)
## Type of Change
- [ ] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context

Looks like this got accidentally deleted in #805

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-11-21 15:33:50 -08:00
Raj 1c0e9888f3 Fix container image prune to actually remove images, add -a flag support, and bump cz to 0.15.0 (#909)
- Fixes #901.

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

## Motivation and Context
Previously `container image prune` called `ImageStore.prune()` (renamed
to `cleanupOrphanedBlobs()` in cz 0.15.0) which only removed orphaned
content blobs and never actually removed images.

This PR fixes that behavior so `container image prune` removes dangling
images by default, and with `-a` removes all unused images, not just
dangling ones.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2025-11-21 10:55:00 -08:00
Dmitry Kovba 7926c317f6 Build input file cannot be found: '.../CAuditToken.o' (#908)
Resolves a build error in Xcode:
> Build input file cannot be found: '.../CAuditToken.o'. Did you forget
to declare this file as an output of a script phase or custom build rule
which produces it?
2025-11-20 16:01:25 -08:00
Raj d327a50219 Add container system df command for disk usage reporting (#902)
- Closes #884. 

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

## Motivation and Context
This PR implements the `container system df` command to display disk
usage statistics for images, containers, and volumes, along with their
total count, active count, size, and reclaimable space for each resource
type.

Active resources are determined by container mount references and
running state, while reclaimable space is calculated from inactive or
stopped resources.

Example output:
```
~/container ❯ container system df
TYPE           TOTAL  ACTIVE  SIZE      RECLAIMABLE
Images         4      3       4.42 GB   516.5 MB (11%)
Containers     4      2       2.69 GB   1.51 GB (56%)
Local Volumes  3      2       208.5 MB  66.2 MB (32%)
```

I'll have some follow-on PRs that will add `-v/--verbose` flag for
detailed per-resource information, `--filter` flag for filtering output
by resource type, and a `--debug` flag for debug statistics like block
usage, clone counts etc.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2025-11-20 09:19:00 -08:00
Ronit Sabhaya c76e0f4f84 Added the split method for labeler workflow (#788)
- This can basically Help teams know what changes are made in pr
- Added the split approach @katiewasnothere suggested using openssf
- Added additional feature for colors
- Currently this is for CLI only later we can add multiple
- Labeling flow
  - TRIGGER: Pull Request Opened (untrusted code)
  - READ-ONLY stage: just save job number to artifact
  - WRITE: load job number artifact, use GH labeler
    action with `labeler.yml` from repo
2025-11-19 20:17:35 -03:00
J Logan 87862d1faa Updates to CZ 0.14.0. (#903) 2025-11-19 18:55:23 -03:00
J Logan b2f5f3ff2f Adds client uid validation to XPC server. (#896)
- When a user performs an `su` the effective UID changes but the bootstrap
  mach port does not, so that if container is running as `alice` from a
  GUI login session, it's possible to `su bob` and continue running
  container. While this doesn't pose a significant security risk as it's
  necessary for Alice to know Bob's password and manually enter it with
  `su`, this change closes the loophole by validating that client UID from
  the caller's audit token matches that of the API server.
2025-11-19 00:41:56 -03:00
Danny Canter 266b135da2 Fix container stats build break (#898)
Seems `run` was changed to return a data blob variant of stdout, which
made the function have a tuple of size 4 instead of 3 now. The stats
tests still used the old 3 wide variant which broke the build.
2025-11-18 16:29:24 -08:00
Danny Canter cf0eba495e Implement container stats (#851)
Closes #824

This implements statistics gathering across the various components, but
ultimately this is for implementing a new CLI command: `container
stats`. This shows memory usage, cpu usage, network and block i/o and
the number of processes in the container. The new command can inspect
stats for 1-N containers and by default continuously updates in a `top`
like stream.

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

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-11-18 14:10:05 -08:00
ChengHao Yang 2d07d8ff96 Fix TestCLICreateCommand failing test (#897)
Signed-off-by: ChengHao Yang
2025-11-18 15:47:08 -03:00